EasyUI Forum
April 20, 2024, 05:03:02 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: custom sorter  (Read 3256 times)
sectioni
Jr. Member
**
Posts: 67


View Profile
« 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/
« Last Edit: May 24, 2017, 03:32:00 AM by sectioni » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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/
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!