groupItemsByProperty

DataTable
stable

Groups an array of IDataTableGroupableItem rows by a single property path, returning a Map whose keys are the distinct property values and whose values are sub-arrays of matching rows. Building block used by groupItems for each groupBy level.

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
Array<T>
The flat list of rows to partition.
groupBy
requis
string
A dot-notation property path applied to each row's raw object via getObjectValueByPath.

API

Valeur de retour

La valeur retournée par cet util.

A Map where each key is a distinct property value and the value is the array of rows that share it. Returns an empty array (not a Map) when items is empty.

Usage

Exemples

Extraits de code prêts à coller.

Partition rows by a field

typescript