5 Replies Latest reply on Mar 24, 2009 10:30 AM by Christoph Sauer

    Sorting doesn't affect session bean / isn't persistent

    Christoph Sauer Newbie

      This is my first post here so hi everyone!
      I'm really new to richfaces and web app development in general, so please talk slowly and clearly ;-)

      I have a problem regarding sorting of a multi-paged dataTable:
      I'm using rich:dataTable together with rich:columns and rich:datascroller:

       <rich:dataTable value="#{AddressesModel.addressesTableData}"
       id="addressOverviewTable" var="address" columns="10"
       headerClass="addressesTableHeader" rowClasses="oddRow,evenRow" rows="10" reRender="addressTableDS">
       <rich:columns id="label#{index}" sortBy="#{address[index]}"
       value="#{AddressesModel.addressesTableLabels}" var="label"
       <f:facet name="header">
       <h:outputText value="#{label}" />
       <h:outputText value="#{address[index]}" />
       <f:facet name="footer">
       <rich:datascroller id="addressTableDS" for="addressOverviewTable" maxPages="10"/>

      When I click on the sorting Icon of a column-header, the data of the complete table is sorted and the current page is displayed correctly. However, when I use the datascroller to get to the next page, the original unsorted data shows up again. Perhaps this is the intended behavior, but what I actually want is this: http://livedemo.exadel.com/richfaces-demo/richfaces/sortingFeature.jsf?c=sorting&tab=usage

      I think/hope I could get along on my own if only I could find the complete source for that demo. I downloaded GA 3.3.0 and (briefly) went through the samples but couldn't locate it.

      So, how can I achieve this? What do I have to configure or implement in order make the tables changes made through sorting persist throughout the session?

      Btw.Here's the configuration of my session bean, at the moment, I provide some testdata by manually filling an ArrayList in the init() method:

      public class AddressesModel implements Serializable{
      private static final long serialVersionUID = -3032793308402273197L;
      private ArrayList<String[]> addressesTableData;
      private ArrayList<String> addressesTableLabels;
      public void init(){
       ArrayList<String[]> addresses = new ArrayList<String[]>();
       String[] tmp = new String[]{"012139","Nintendo","GmbH","Geo-Strasse","4","Fr","76312","Paris","false","false"};
       //...if you don't mind, I will skip the rest of the Arrays here
       this.addressesTableData = addresses;
      public AddressesModel(){
      public ArrayList<String> getAddressesTableLabels() {
       return addressesTableLabels;
      public void setAddressesTableLabels(ArrayList<String> addressesTableLabels) {
       this.addressesTableLabels = addressesTableLabels;
      public ArrayList<String[]> getAddressesTableData() {
       return addressesTableData;
      public void setAddressesTableData(ArrayList<String[]> addresses){
       this.addressesTableData = addresses;
      public void addAddress(String[] address) {

      Thanks in advance for any advice on what I missed here ;-)

      best regards

      P.S.: what am I expected to do with the doc folder of the release archive? Whats wrong with plain .pdf's or a html-doc? =D