Hi all,
The DVD Store example shows using @DataModel, @Factory and JSF's isRowAvailable():
@DataModel
| List<Order> orders;
|
| @DataModelSelection
| @Out(value="myorder", required=false, scope=ScopeType.CONVERSATION)
| Order order;
|
| @Begin @Factory("orders")
| public String findOrders() {
| :
| }
<f:subview rendered="#{!orders.rowAvailable}">
| <p>You have not placed any orders.</p>
| </f:subview>
The above works fine as long as the URL is not reloaded (Ctrl-R in the browser).
However, when the URL includes a conversation ID (like &cid=123) then upon reloading
the page, rowAvailable might yield false (as rowIndex == -1) while rowCount > 0. Is
this the expected behavior?
For example:
In the online demo (which might be out of date, but I get the same behavior in my own
code) clicking "My orders" works fine. Then, clicking Show Details for some
order will make the URL include a &cid parameter (in fact named conversationId in that
example, like showorders.seam?conversationId=123). Next, Ctrl-R or "Go" for that
URL results in "You have not placed any orders". At this point the debug page
shows, for example:
Component (orders)
| class class org.jboss.seam.jsf.ListDataModel
| dataModelListeners []
| rowAvailable false
| rowCount 22
| rowData java.lang.IllegalArgumentException[row is unavailable]
| rowIndex -1
Next, clicking on "My orders" again (which has propagation="none")
will correctly show the list again. This, however, triggers the @Factory method, and thus
fetches fresh results from the database.
In my own code I'm now using rowCount, just like in all the other examples that use
@Datamodel. But I'm still wondering if this is the expected behavior? Does one need
some additional setup (such as scope in the @DataModel) when relying on isRowAvailable()?
Thanks,
Arjan.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028839#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...