Loading ...
Sorry, an error occurred while loading the content.

dataTable progressive sorting

Expand Messages
  • colmaengusmurphy
    Hi folks, It would be nice if the dataTable client sorting supported progressive sorting. By this I mean that if you click on a col to sort by and then click
    Message 1 of 1 , Apr 1 9:37 AM
    View Source
    • 0 Attachment
      Hi folks,

      It would be nice if the dataTable client sorting supported progressive sorting. By this I mean that if you click on a col to sort by and then click on another col if there are rows with the same value as far as the second col sort is concerned the order is left the same as from the first sort.
      Currently this doesn't happen.
      Looking around the code I see the following (datatable.js 2.7.0)

      sortFnc = sortFnc ||
      function(a, b, desc) {
      var sorted = YAHOO.util.Sort.compare(a.getData(sField),b.getData(sField), desc);
      if(sorted === 0) {
      return YAHOO.util.Sort.compare(a.getCount(),b.getCount(), desc); // Bug 1932978
      }
      else {
      return sorted;
      }
      };

      When I take out the check on sorted and just return sorted hey presto progressive sorting works.

      I can see there is a checkin comment explaining the ref to 1932978
      http://github.com/yui/yui2/commit/8581d93859104749c469d34caccf6b00e71a4a8a

      What I'm wondering is why we need the sub-sort at all ?

      Regards

      Colm A
    Your message has been successfully submitted and would be delivered to recipients shortly.