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
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- itemsrequiredArray<T>
- The flat list of rows to partition.
- groupByrequiredstring
- A dot-notation property path applied to each row's raw object via getObjectValueByPath.
API
Return value
The value returned by this 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
Examples
Ready-to-paste usage snippets.
Partition rows by a field