4 Replies Latest reply on Apr 28, 2010 6:55 AM by Jonathan Moores

    ExtendedDataTable filtering and select all

    Jonathan Moores Newbie

      I am trying to get a select/deselect all working with the extendedDataTable. I have began with the demo code as a starting point so I in my managed bean I have an ArrayList of the selected items that is currently being held in the Selection and is displayed in a separate table in the html page.

       

      I have seen discussions about this before but I have the following issues:

       

      - If I use the SimpleSelection.clear() and SimpleSelection.setSelectAll(true|false) this leaves the selection object empty with only the 'selectAll' attribute of the selection set.

       

      - If I filter for a specific value and then select all and then remove the filter I would like to only have the items selected as were shown during filtering. This is not the case with SimpleSelection.setSelectAll(true).

       

      So I guess at the end of all that - how do I get my hands on the row keys that are currently displayed (with filtering applied)??

       

      Thanks

      Jon

        • 1. Re: ExtendedDataTable filtering and select all
          Ilya Shaikovsky Master
          - If I use the SimpleSelection.clear() and SimpleSelection.setSelectAll(true|false) this leaves the selection object empty with only the 'selectAll' attribute of the selection set.

          works as intended. Talking for example about scrollable table - you could have very large set of objects and we does not want to duplicate lists by moving all to the selection list. It's just flag for you to iterate over all the list in order to get selection. And table will do it out of the box.

           

          - If I filter for a specific value and then select all and then remove the filter I would like to only have the items selected as were shown during filtering. This is not the case with SimpleSelection.setSelectAll(true).

          this related to the same. selectAll() means that table has all the element selected. Doesn't matter if them selected with filtering or not. In order to select all considering selection - do not use the method and add only elements you need by using dataModel walk.

          1 of 1 people found this helpful
          • 2. Re: ExtendedDataTable filtering and select all
            Jonathan Moores Newbie

            Thanks for the info. Handy.

             

            So... using the walk() method on the dataModel. I can walk the full range of the data provider no problem. That just gives back the rowKeyVars of all records with I can use to get the underlying data object. So how do I know which rows are currently visible in the rendered table (considering filtering and sorting)?

            • 3. Re: ExtendedDataTable filtering and select all
              Ilya Shaikovsky Master

              Your model should be implemented properly as shown at richfaces-demo dataTable  HibernateDataModel page.(full sources in svn)

              • 4. Re: ExtendedDataTable filtering and select all
                Jonathan Moores Newbie

                Seems that using ExtendedTableDataModifiableModel works ok.

                 

                Thanks!