Custom sorting in DataGrid

Tutorial » Custom sorting in DataGrid

If the default sort behavior is not adequate for your requirements, you can customize the datagrid's sorting behavior.

Basically the user could define a sort function named sorter on column, the function will receive two values and the return value will be as follows:

valueA > valueB => return 1

valueA < valueB => return -1

The Custom Sorting Code

As you can see from this code, we create a custom sorter for date column. The date format is 'dd/mm/yyyy' and can be easily sorted in year, month, day order.

Download the EasyUI example:

easyui-datagrid-demo.zip