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

typescript
comparator?: GridCallback<[TValue, TValue, Readonly<TData>, Readonly<TData>], number>
ItemValue
RequiredOptional
Input typeGridCallback<[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