sortItems

DataTable
stable

Sort an array of internal data-table items by one or more sort keys and directions, with optional custom compare functions per key.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

items
requis
T[]
The array of internal items to sort. Each item must satisfy IInternalItem (has a raw property).
sortByItems
requis
Array<IDataTableSortItem>
Ordered list of sort descriptors. Each entry specifies a key and an order ("asc" | "desc" | false).
options
{ transform?: (item: T) => Record<string, any> sortFunctions?: Record<string, TDataTableCompareFunction> sortRawFunctions?: Record<string, TDataTableCompareFunction> }
Optional overrides: transform maps an item before comparison; sortFunctions and sortRawFunctions provide per-key compare functions.

API

Valeur de retour

La valeur retournée par cet util.

A new sorted array of items. The original array is not mutated.

Usage

Exemples

Extraits de code prêts à coller.

Sort by a single key ascending

typescript