Okay, understood Peter (and thanks!). Sorry about being persistent
though, but aren't there any other ways of doing this?
I haven't seen it in any examples, is it common practice to override
columns?
Peter Svensson wrote:
Uh no :) I think I misunderstood you.
But a table shows only one list at a time, where all properties of the
current object (which will be the row) make up the fields in the row.
If you want to insert fields from another kind of object, it might get odd,
since there is no natural relation in order between the two lists, unless
you are absolutely certain that the lorder of each list can be trusted and
make sense.
In that case you can define a column in you table which does not exist as a
property at all in the objects in the first list, then override that column
with a "block override" thus;
<div jwcid="@contrib:Table source="ognl:posts" columns="foo, bar, baz">
<div jwcid="[EMAIL PROTECTED]">
<div jwcid="ognl:renderbaz">
</div>
</div>
But then you would have to keep track of the row as well.
Gotta run!
cHEERS,
ps
On 3/8/06, Nima Boustanian <[EMAIL PROTECTED]> wrote:
Peter Svensson wrote:
Well either you could use two tables, or you could have a third method
mix
the two.
Don't you just want to have one or two of the columns in the first table
show something from the other list?
The way I would do that is to just add a property for the Post object
that
refers to a specific Person object.
Then you could add a couple of columns in your columns="" binding that
actually refers to properties in person, like;
columns="columns="listOfPosts:Title:title, personName:Name:myPerson.name"
where you add in Post.java;
Person myPerson;
public Person getMyPerson()
{
return myPerson;
}
anbd of course you have a getName() method on person. Would that work??
Cheers,
PS
On 3/8/06, Nima Boustanian <[EMAIL PROTECTED]> wrote:
Hey all
How do I output data from multiple sources into one contrib:Table?
What I do at the moment is:
<table jwcid="[EMAIL PROTECTED]:Table"
id="conversationsPlaceHolder" source="ognl:posts"
columns="listOfPosts:Title:title,
listOfPosts:Created:createdDate"
class="postTable" cellpadding="2"
cellspacing="2" width="100%">
Where the data source for source="ognl:posts" is
public List getPosts() {
return getPostManager().getPosts();
}
The above example works fine, but what if I have another method which
returns
public List getPerson() {
return
getPersonManager().getPersons();
}
How can I use both sources in one table? If this isn't possible, are
there any other components that should be used instead?
Thanks!
Btw - if there are other newbies out there interested in Tapestry
components, check out this site I stumbled across recently,
it can come in handy: http://xdoclet.codehaus.org/TapestryTags
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hmm.. not quite sure if I follow you Peter, what I have now is:
public abstract class ConversationsPlaceHolder extends BaseComponent {
@InjectObject("spring:tagManager")
public abstract TagManager getTagManager();
@InjectObject("spring:postManager")
public abstract PostManager getPostManager();
public List getPostTags() {
return getTagManager().getTags();
}
public List getPosts() {
return getPostManager().getPosts();
}
Both methods are in the same class... are you saying that I should have
a third method which mixes getPostTags and getPosts?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]