2 Replies Latest reply on Feb 10, 2009 12:17 PM by maxmustang

    sorting and exporting from a rich-datatable

      Hi,
      i came across an issue when trying to take use of the sort function of rich:datatable. Somehow the collection itself is not sorted what makes an appropriate export (pdf) impossible. Even when assigning my own comparator the original collection was not touched. Is there a way to force a sorting of my collection, or will i have to make a propertyx binding for each column, check each one for its current state and sort again (manually) when the users presses the export button??
      Thanks in advance.

        • 1. Re: sorting and exporting from a rich-datatable
          maxmustang

          Hi Janson,

          Did you find a solution? I need exactly the same.

          Greetings MAx

          • 2. Re: sorting and exporting from a rich-datatable
            maxmustang

            ok i found a solution that works for me:

            Getting Table from the GUI as it is sorted on the GUI:

            import org. richfaces.component.html .HtmlDataTable;

            HtmlDataTable personsTable = (HtmlDataTable)FacesContext.getCurrentInstance().getViewRoot().findComponent("form1:persons");
            for (int i = 0; i < personsTable.getRowCount(); i++) {
            //loop over the rows
            personsTable.setRowIndex(i);
            //get the values from row and add it a Person-Bean
            Person person = (Person) personsTable.getRowData();
            // Add the person to a List for further needs f.i. a pdf
            persons.add(person);
            }