developer guide
JavaScript Data Grid Sorting
Click a header to sort, hold shift to add a second and a third, and every column orders itself as its own type rather than as text. Where the order is particular to your data, a compare function on the column decides it.
Developer guide › Sorting, filtering and find › JavaScript Data Grid Sorting
Sorting
Setting and reading
grid.sort.set([{ col: 'capacity', dir: 'desc' }]);
// A multi-column sort is one call, in priority order.
grid.sort.set([
{ col: 'region', dir: 'asc' },
{ col: 'capacity', dir: 'desc' },
]);
grid.sort.get(); // [{ col, dir }, …]
grid.sort.clear();
Clicking a header cycles ascending, descending, none; shift-clicking a second header adds to
the sort rather than replacing it. A column can supply its own compare, and a
type already has one: dates compare chronologically, IP addresses numerically rather than as
strings, durations by length.