EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: sectioni on May 24, 2017, 03:20:30 AM



Title: custom sorter
Post by: sectioni on May 24, 2017, 03:20:30 AM
Hi,

I have a column with decimal values.
The default sorter doesn't work properly (the decimal values are strings in the json and that's not something i can change right now) so I will need to add a custom sorter.
But I am having problems with sorting direction. I need help doing the sorter.

Check the file size column:
https://jsfiddle.net/1t6vndt4/4/


Title: Re: custom sorter
Post by: jarry on May 24, 2017, 08:17:05 AM
The 'sorter' function should be:
Code:
sorter: function (a, b) {                    
     return parseFloat(a) > parseFloat(b) ? 1 : -1;
}
Fore more information please look at this updated example https://jsfiddle.net/1t6vndt4/5/