SortState
Sort state passed to custom sort handlers. Represents the current sorting configuration for a column.
Example
Section titled “Example”// In a custom sort handlerconst sortHandler: SortHandler = (rows, sortState, columns) => { const { field, direction } = sortState; console.log(`Sorting by ${field} ${direction === 1 ? 'ASC' : 'DESC'}`);
return [...rows].sort((a, b) => { const aVal = a[field]; const bVal = b[field]; return (aVal < bVal ? -1 : aVal > bVal ? 1 : 0) * direction; });};Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
field | string | Field to sort by |
direction | -1 | 1 | Sort direction: 1 = ascending, -1 = descending |
See Also
Section titled “See Also”SortHandlerfor custom sort handler signatureSortChangeDetailfor sort change events
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