-
1. Re: DataModel/dataTable for rendering 2 tables
trickyvail Oct 8, 2007 10:28 AM (in response to mpw)I think you are trying to call getMls() on the listings collection inside Sellers. The collection does not have this method. You will first need to use a jsf iteration tag like h:dataTable, ui:repeat or rich:dataTable. Something like this:
<ui:repeat value=#{somebean.sellers} var="seller"> <h:outputText value="#{seller.name}"> <ui:repeat value="#{seller.listings}" var="listing"> <h:outputText value="#{listing.mls}"/> </ui:repeat> </ui:repeat>
-
2. Re: DataModel/dataTable for rendering 2 tables
mpw Oct 8, 2007 2:14 PM (in response to mpw)thanks for the reply. however, i need to use the DataModel because
i will be also using @DataModelSelection to show the
detail of the selected row of the record.
Yes, i have getter and setter methods for 'mls' and my
other fields as well.
Michael -
3. Re: DataModel/dataTable for rendering 2 tables
trickyvail Oct 8, 2007 5:18 PM (in response to mpw)Just a hunch here, but is your collection a Set? JSF does not iterate correctly through sets. If you are using a set, try changing it to a List, or creating a transient method that instantiates and returns a new ArrayList constructed from the set.
-
4. Re: DataModel/dataTable for rendering 2 tables
mpw Oct 8, 2007 5:23 PM (in response to mpw)yes, I am using a 'Set' as my many entity. I will change it to a List
and see what happens.
the question is should 'datatable' be able to iterate through the
'many' section of the one-to-many relationship ie fields from both
tables or should i be using another approach?!
thanks again.
Michael -
5. Re: DataModel/dataTable for rendering 2 tables
trickyvail Oct 8, 2007 6:04 PM (in response to mpw)Yes, DataTable can iterate through a One to Many collection of an entity. However there are limitations to what kinds of collections are acceptable. Lists and Arrays are allowed, Sets are not (because they are unordered).
-
6. Re: DataModel/dataTable for rendering 2 tables
trickyvail Oct 8, 2007 6:13 PM (in response to mpw)Just found a JSF forum posting about this:
http://forum.java.sun.com/thread.jspa?threadID=589709&messageID=3062225 -
7. Re: DataModel/dataTable for rendering 2 tables
mpw Oct 8, 2007 9:21 PM (in response to mpw)this is very interesting.
I was unaware that JSF with seam datatable needed to access
the rows via the indices which in a way sounds reasonable.
Note:
Looking through all the Seam examples i was not able to find an
example of an application using the DataTable accessing fields
from both entities with the one-to-many relationship.
thanks much for the pointer.
Michael