1 Reply Latest reply on Oct 1, 2009 6:21 AM by Ilya Shaikovsky

    rich:dataTable's sort state and Seam's EntityQuery

    Jarden Mierd Newbie

      Hi all !

      I'm using a rich:dataTable to display the results of a search into the DB.
      The search is accomplished by using Seam's EntityQuery.

      After seeing the search results the user can click on a "generate report" button to be taken to a page that shows a report based ONLY on whatever search results showed up - The data that is fed into my report generator is EntityQuery's getResultList().

      Thing is, my table can be sorted in different ways by clicking it's column headers. I would like different orderings of the results to be reflected in what is fed into the report generator (so the report generated will also reflect the sorting).

      It seems the rich:dataTable only reads my resultList, and when the user sorts the table by clicking a column header, rich:dataTable does not affect in any way my resultList.

      That makes sense, my question is : How can this be accomplished ?

      Maybe I should be feeding into my report, not EntityQuery's resultSet, but rich:dataTable's "dataSet" (if one exists - a data set that holds rich:dataTable's data set in what ever sorted state it may be in).

      I actually think rich:dataTable doesn't hold this data set anywhere - Because I see that each time I sort the table, the DB is re-enquired. In which case maybe I can somehow intercept rich:dataTable's operation when the user sorts the table - to save aside the sorted data set.
      Or - maybe each time the user sorts I can "borrow" from rich:dataTable the query string it used (in which the sort is reflected).

      Are any of these valid directions?
      I am not sure if this is the place to post this, but I'd thought to give it a try.
      Any advice would be great! Thanks!