2 Replies Latest reply on May 5, 2008 6:34 AM by mbinna

    Getting the selection from a ScrollableDataTable

    mbinna

      Is it possible to outject the selection from a RichFaces' ScrollableDataTable as an object in the context? I don't want to deal with a row number or such things. I want to select a row in the Table and when that row is selected a component in the context should be updated.

      I already tried the following in my session bean:

      @DataModel
      private List<Item> itemList
      @DataModelSelection
      private Item selectedItem


      But when I print out some of the properties of selectedItem, the same values are printed out, no matter which item is selected.

        • 1. Re: Getting the selection from a ScrollableDataTable
          cardel

          I have the same problem. It looks like some bug. DataModelSelection is returned in right way when I use the same dataTable without sorting or filtering. When I use same table with sorting or filtering I get only one (I think the last) record returned as DataModelSelection from all rows of table.

          • 2. Re: Getting the selection from a ScrollableDataTable
            mbinna

            Ok, finally I got it working using a h:dataTable and using the annotation DataModel and DataModelSelection. I think the problem was that the action was not triggered in the column but by a button global to all columns of the table.

            I'm relatively new to J2EE and Seam, so it might be possible to get that working too if one as enough experience. If someone has good advice, please let me know. ;-)

            in Manager.java:

            @DataModel
            private List<Item> itemList;
            
            @DataModelSelection("itemList")
            private Entity selectedItem;
            


            Code from list.xhtml:

            <h:dataTable value="#{itemList}" var="item">
             <h:column>
             <h:commandLink value="#{item.description}" action="#{manager.edit}"/>
             </h:column>
            </h:dataTable>
            

            Regards, Manuel Binna