Row grouping options and events
Single-depth grouping with parent-owned groups, membership, and expansion. Distinct from tree children. The explicit groups array determines group order.
Grouping and selection example
CominsRowGroupingConfig
Section titled “CominsRowGroupingConfig”groups
Section titled “groups”groups: readonly TGroup[];Required group definitions. Empty groups remain visible; sorting applies to rows within each group.
getGroupId
Section titled “getGroupId”getGroupId: (group: TGroup) => CominsRowId;Required stable unique group ID.
getRowGroupId
Section titled “getRowGroupId”getRowGroupId: (row: TData, dataIndex: number) => CominsRowId;Required resolver from source row and dataIndex to its group ID.
getGroupLabel
Section titled “getGroupLabel”getGroupLabel?: (group: TGroup) => React.ReactNode;Group-header label; defaults to the string form of the group ID.
expandedGroupIds
Section titled “expandedGroupIds”expandedGroupIds?: readonly CominsRowId[];Parent-owned expanded group IDs. Defaults to an empty array; update via onChangeExpandedGroupIds.
onChangeExpandedGroupIds
Section titled “onChangeExpandedGroupIds”onChangeExpandedGroupIds?: (groupIds: CominsRowId[]) => void;Reports the full next ID array on expansion/collapse requests. Apply it to update the view.
aggregations
Section titled “aggregations”aggregations?: Readonly<Partial<Record<string, CominsRowGroupAggregation>>>;avg/count/max/min/sum by column ID. None when omitted. With filtering, aggregates only filtered group members.
renderGroupContent
Section titled “renderGroupContent”renderGroupContent?: (params: CominsRowGroupRenderParams<TData, TGroup>) => React.ReactNode;Custom group-header content; omission uses the built-in label/count presentation.
getGroupRowProps
Section titled “getGroupRowProps”getGroupRowProps?: (params: CominsRowGroupRenderParams<TData, TGroup>) => CominsRowGroupProps | undefined;Returns className/style for a group row, separate from ordinary rowProps.
groupDraggable
Section titled “groupDraggable”groupDraggable?: boolean;Default false. Enables group reordering; update the parent array through onChangeGroups.
onChangeGroups
Section titled “onChangeGroups”onChangeGroups?: (groups: TGroup[], details: CominsRowGroupMoveDetails) => void;Receives the new group array and move details. Separate from row-data changes.
setRowGroupId
Section titled “setRowGroupId”setRowGroupId?: (params: CominsSetRowGroupIdParams<TData>) => TData;Returns a row with updated membership for a cross-group move. Do not mutate the original. Apply data through onChangeData.
CominsRowGroupRenderParams
Section titled “CominsRowGroupRenderParams”export type CominsRowGroupRenderParams<TData, TGroup> = { aggregateValues: Readonly<Record<string, number | null>>; expanded: boolean; group: TGroup; groupId: CominsRowId; groupIndex: number; isEmpty: boolean; rowCount: number;};groupIndex is the position in groups; rowCount and aggregateValues describe current group members.
CominsRowGroupMoveDetails
Section titled “CominsRowGroupMoveDetails”export type CominsRowGroupMoveDetails = { fromIndex: number; groupId: CominsRowId; reason: "move"; targetGroupId: CominsRowId; toIndex: number;};Group reorder result. fromIndex/toIndex are group-array indexes; reason is move.
CominsSetRowGroupIdParams
Section titled “CominsSetRowGroupIdParams”export type CominsSetRowGroupIdParams<TData> = { fromGroupId: CominsRowId; row: TData; rowId: CominsRowId; toGroupId: CominsRowId;};fromGroupId/toGroupId identify the membership change. Return a row containing the new group field.
Related API
Section titled “Related API”label?: { render?: (group: TGroup) => React.ReactNode; };See the 0.2.2 migration guide for rendering precedence and return values.
content
Section titled “content”content?: { render?: (params: CominsRowGroupRenderParams<TData, TGroup>) => React.ReactNode; };See the 0.2.2 migration guide for rendering precedence and return values.