API REFERENCE
comparator
Compares two values and rows for sorting. Negative, zero, and positive results mean before, equal, and after.
What does this API do?
Compares two values and rows for sorting. Negative, zero, and positive results mean before, equal, and after.
Exact input and result types
comparator?: GridCallback<[TValue, TValue, Readonly<TData>, Readonly<TData>], number>| Item | Value |
|---|---|
| Required | Optional |
| Input type | GridCallback<[TValue, TValue, Readonly<TData>, Readonly<TData>], number> |
Usage flow
Set this on an individual column object in columnDefs. Pass arrays, objects, and callbacks through JavaScript, and use new arrays or objects when applying changes.
Read related types
Feature explanations and examples
- Single and multiple sorting
Sorting changes display order without modifying data values. Single sorting uses one criterion; multiple sorting uses prioritized criteria.