groupItems
DataTable
stable
Recursively groups an array of data table rows by one or more property keys. Each level produces an array of IDataTableGroup objects that carry depth, id, key, value, and the nested items. Used internally by OrigamDataTable grouping.
API
Signature
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- itemsrequiredArray<T>
- The flat list of data table rows to group.
- groupByrequiredArray<string>
- Ordered list of property paths to group by. The first element is the outermost grouping level.
- depthnumber0
- Current recursion depth. Start at 0 (default) for the outermost call.
- prefixstring'root'
- Prefix used to build stable unique group ids. Defaults to "root".
API
Return value
The value returned by this util.
- A nested array of group descriptors. Returns an empty array when groupBy is empty.
Usage
Examples
Ready-to-paste usage snippets.
Single-level grouping