1 Reply Latest reply on Nov 5, 2009 6:24 PM by nbelaevski

    Confusion about rich:extendedDataTable sorting

    zjda

      Hi, To my understanding there are 2 different ways to sorting rich:extendedDataTable: a) implements Modifiable and b) use sortOrder/sortPriority.

      I would like to use the second method because modify method of Modifiable is called too many times (ajaxSingle and limitToList did not help very much). And each time we have to call areSortFieldsEqual(List<SortField2> sortFields) to compare sortFields. Using the second method I can avoid it by binding sortOrder to an instance of

      class SortOrderMap<String, SortOrder> extends HashMap<String, SortOrder> {
       @Override
       public SortOrder put(String key, SortOrder value) {
       cachedItems = null;
       cachedRange = null;
       return super.put(key, value);
       }
      }
      

      If I don't implements Modifiable, however, the sequenceRange.getRows() in walk method returns -1.

      On the other hand, if I implement Modifiable and use modify() method I have to use sortOrder attribute. Otherwise, modify() never gets called. Actually the property the sortOrder binds to is not useful at all since modify() has sortFields passed in as a parameter.

      Therefore, it looks like that I have to implements Modifiable and bind sortOrder to something. Do I miss or misunderstand something? It will be appreciated if someone can clarify it.

      -ZJ