-
1. Re: Working with rich:extendedDataTable & SEAM
gonorrhea May 5, 2009 1:12 AM (in response to coalas)There are plenty of examples of this in the Seam examples that are provided with the distro download. See the booking example.
Anyways, I'll explain briefly.
Typically you use rich:dataTable to loop thru entities in a List. Many times rich:dataTable is used in conjunction with @DataModel to outject a ListDataModel instance to the view.
Here's a simple example:
foo.xhtml:
<rich:dataTable id="dataTable1" value="#{listValueEntityList}" var="listVal"> <rich:column> <f:facet name="header"><h:outputText value="Code"/></f:facet> <h:outputText value="#{listVal.code}"/> </rich:column> </rich:dataTable>
backing bean:
@Name("listManagement") @Stateful public class ListManagementAction implements ListManagementLocal { @DataModel private List<ListValueEntity> listValueEntityList; public void populateDataTable(){ listValueEntityList = entityManager.createQuery("select lve from ListValueEntity lve").getResultList(); } }
So in this example, when the populateDataTable() method is called from the JSF, a ListDataModel instance will be outjected to CONVERSATION scope and will be available when the rich:dataTable is subsequently rendered (or reRendered).
Alternatively, without the usage of @DataModel, you can refactor the populateDataTable() method to return a List<foo> and then reference the foo entities directly in your dataTable component via the listVal variable. The
var
attribute represents whatever object type the List or ListDataModel contains.There is also @DataModelSelection which injects the entity value for the row in the dataTable that the user clicks on when submitting the form. This is also useful when you need access to the row data for that particular row that was clicked.
That's the basic idea, hope that helps...
-
2. Re: Working with rich:extendedDataTable & SEAM
pedalshoe Jun 30, 2009 4:09 PM (in response to coalas)thanks for your reply but it isn't with extendedDataTable. There is no example of extendedDataTable where the selection is captured in the bean.
Do you have another example?
Thank you -Christopher