Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tanu on Aug 19, 2009 03:08
open dhtmlx forum
DhtmlxGrid Sorting on equal values

Hi ,

I have written my custom sorting function , and it is working fine when the values are unequal , but when all the values are equal , the grid appears to be refreshed , ideally it should not since all values are equal .

Following is the snippet from javascript function , however its not working.Could you please help me in refining the logic.

if (a==b) {
                    return // what ; I tried with 0 but not working
                }
                if (order=="asc") {
                return (a>b?1:-1);
                    
                }
                 else {
            return (a<b?1:-1);
                }
Answer posted by Support on Aug 19, 2009 03:23
Default javascript sorting in unstable ( http://en.wikipedia.org/wiki/Stable_sorting )
You can enable stable sorting in grid by using
         grid.enableStableSorting(true);