Sorting

There are 2 sorting approaches.

Local sorting

To enable local sorting, you need to set for columns that needs to be sorting, param


sortable: true,

Server sorting

To enable server sorting, you need either enable sorting for needed columns


sortable: true,
And set in data property

data: {
  remoteSort: true,
  proxy: {
    url: 'ajax.php'
  }
},

If data is from server and paged than if to enable sorting than it will be auto set to remoteSort: true.

On server sorting params will be avaliable in params: sort and dir.
sort is for index(key), dir is direction of sorting, can have 2 values(asc, desc)

Server multi-sorting

If data is multisorted than grid sends another params(comparing to usual sorting) on server.


data: {
  remoteSort: true,
  proxy: {
    url: 'ajax.php'
  }
},
multiSort: true,

On server it will be sent param sorters

Example: Sorted grid by 2 columns.
Param sorters is Array.
Each item of array contains 3 params - key - column index(key), dir - sorting derection, type - sorter: string|number.


sorters: [{
  key: 'surname',
  dir: 'ASC',
  type: 'string'
},{
  key: 'age',
  dir: 'DESC',
  type: 'number'
}]
`