Skip to content

SortChangeDetail

Detail for a sort change (direction 0 indicates cleared sort).

grid.on('sort-change', ({ field, direction }) => {
if (direction === 0) {
console.log(`Sort cleared on ${field}`);
} else {
const dir = direction === 1 ? 'ascending' : 'descending';
console.log(`Sorted by ${field} ${dir}`);
}
// Fetch sorted data from server
fetchData({ sortBy: field, sortDir: direction });
});
PropertyTypeDescription
fieldstringSorted field key.
direction-1 | 0 | 1Direction: 1 ascending, -1 descending, 0 cleared.
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt