2 Replies Latest reply on Jul 18, 2011 7:36 AM by Mark Paluch

    Simple sorting and paging dataTable problem

    Ivan Simplename Newbie


      I'm new to RichFaces framework, I want to do one thing:

      table with paging and sorting, where sorting by some field is enabled when I'm clicking header of column (not link) - classical view with icons that show direction of sorting (asc or desc).

      I've tried example



      Paging is working perfectly. I tried to do sorting.


      I have MyDataModel extends ExtendedDataModel<MyData> implements Arrangeable. I have method "walk" where I'm getting sortFields from ArrangeableState. I just need sortable headers in table which will be passed into ArrangeableState state object. How can I get such table headers?


      <rich:dataTable id="richTable" var="log"

                          value="#{myBean.dataModel}" rows="20">

                          <rich:column id="system" sortBy="#{log.system}">

                              <f:facet name="header">

                                  <h:outputText value="System"/>


                              <h:outputText value="#{log.system}" />



                          <f:facet name="footer">

                              <rich:dataScroller id="scroller" />




      I have table with pagination but without any action when I click column header. I'm expecting such sequence: I click column header, image showing direction appears (asc or desc), then my method arrange(FacesContext context, ArrangeableState state) is executed, I save ArrangeableState object, then my method "walk" is executed. In this method I'm getting sort fields: arrangeableState.getSortFields(). Then I call visitor.process(context, myObj.getId(), argument).


      Thank you!