2 Replies Latest reply on Jun 30, 2009 4:09 PM by Christopher Logan

    Working with  rich:extendedDataTable & SEAM

    Chris Lambert Newbie

      I'm newbie here , so please forgive me any stupid mistakes :)

      I need to take multiple/single selection of  extendedDataTable component, the example from richfaces doesn't work in seam.
      When I try to bind the table with seam component

      (I remember that Conversational components have one minor limitation: they cannot be used to hold bindings to JSF components. We generally prefer not to use this feature of JSF unless absolutely necessary- seam reference)

      always get this error

      javax.el.ELException: /test.xhtml @51,163 binding="#{extable.exTable}": java.lang.IllegalArgumentException: argument type mismatch

      The binding component looks like this:

      public class ExTable {
           private UIExtendedDataTable exTable ;
           public UIExtendedDataTable getExTable() {
                return exTable;
           public void setExTable(UIExtendedDataTable exTable) {
                this.exTable = exTable;

      (HtmlExtendedDataTable doesn't change anything here)

      So, if binding jsf components is unrecommended anyway... how should I work with data tables, when I need to work with some chosen objects, displayed on them?

      Any examples, suggestions.. pleeease :)

        • 1. Re: Working with  rich:extendedDataTable & SEAM
          Arbi Sookazian Master

          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:


          <rich:dataTable id="dataTable1" 
                         <f:facet name="header"><h:outputText value="Code"/></f:facet>                    
                              <h:outputText value="#{listVal.code}"/>

          backing bean:

          public class ListManagementAction implements ListManagementLocal {
               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
            Christopher Logan Newbie

            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