[jboss-user] [JBoss Seam] - Re: 2 DataModel questions
bfo81
do-not-reply at jboss.com
Thu Aug 31 08:53:26 EDT 2006
I haven't seen a Seam example for that. It's been something else but that's a long time ago.
Well, I just tried something out. I have a list of persons (my favorite example here in the seam forum *g*), and the person has friends (that are persons, too).
In that list of persons each person has a column where all friends are listed:<h:dataTable var="person" value="#{personList.entries}">
|
| <h:column>#{person.name}</h:column>
| <h:column>#{person.nick}</h:column>
| <h:column>#{person.country}</h:column>
| <h:column>
| <h:dataTable var="friend" value="#{person.friends}">
| <h:column>#{friend.name}</h:column>
| </h:dataTable>
| </h:column>
| </h:dataTable>
And it works, look:
| +-------------------+-------+-------------+-----------------+
| | Stefan Berkmiller | bfo81 | Deutschland | Frank Hoyer |
| | | | | Florian Mueller |
| | | | | ... |
| +-------------------+-------+-------------+-----------------+
| | .....
Problem here: The datatable is shown for every person. You may add a link "Show Friends" that stores the id. Well, look:
Your bean:
| @RequestParameter
| private Long personId;
|
| @Out(required=false)
| private Long showFriendsForPersonId;
|
| public String showFriends() {
| showFriendsForPersonId = personId;
| return null;
| }
And then your Detail column should be like this:
| <h:column>
|
| <h:commandLink value="Show Friends" action="#{yourBean.showFriends}" rendered="#{showFriendsForPersonId != person.id}">
| <f:param name="personId" value="#{person.id}">
| </h:commandLink>
|
| <h:dataTable ... rendered="#{showFriendsForPersonId == person.id}">
| shows friends, see above
| </h:column>
| ...
Then there is always only one person whose friends are shown and the other persons have a "Show Friends" link.
Is that about what you're looking for?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968615#3968615
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968615
More information about the jboss-user
mailing list