Capítulo 40 de 54
columnGroupingFeature categorizes rows by shared column values into a tree (grouped rows hold matching rows as subRows, replacing them at the position of the first match) — it's independent of rowAggregationFeature now, so register grouping alone for pure categorization, or both together when grouped rows should also show computed totals.
columnOrder → grouping). With an active grouping state and groupedColumnMode: 'reorder' (default-equivalent behavior — grouped columns move to the front) or 'remove' (grouped columns disappear from the flow entirely), or false (leave column position untouched).columnGroupingFeature + groupedRowModel: createGroupedRowModel() for client-side; manualGrouping: true (skip the row model) for server-side — though the docs note there isn't yet an easy, well-established pattern for server-side grouping; expect custom cell-rendering work.GroupingState = string[] — an ordered list of column ids, e.g. ['region', 'plan'] groups by region first, then by plan within each region. table.setGrouping([...]), table.resetGrouping().rowExpandingFeature + expandedRowModel: createExpandedRowModel() alongside grouping.autoResetPageIndex/autoResetExpanded/autoResetAll). Under manual (server-side) grouping with the row model skipped, those hooks don't fire — reset dependent state by hand in the grouping change handler.atoms: { grouping: atom } (v9-recommended) or classic state.grouping + onGroupingChange.column.toggleGrouping(), column.getToggleGroupingHandler(), column.getCanGroup(), column.getIsGrouped(), column.getGroupedIndex() (position within the grouping order).row.getIsGrouped(), row.getGroupingValue(columnId), row.groupingColumnId, row.groupingValue.cell.getIsGrouped(), cell.getIsPlaceholder() (a cell in a grouped row for a column not being grouped by — typically rendered blank).table.getGroupedRowModel() / table.getPreGroupedRowModel() (the row set before grouping — this is what the Row Models Guide's fixed pipeline order refers to).const features = tableFeatures({
columnGroupingFeature, rowExpandingFeature,
groupedRowModel: createGroupedRowModel(),
expandedRowModel: createExpandedRowModel(),
})
const table = useTable({ features, columns, data, groupedColumnMode: 'reorder' })
table.setGrouping(['region', 'plan'])
// rendering a grouped cell vs. a placeholder cell vs. an ordinary cell
cell.getIsGrouped() ? renderGroupHeaderCell(cell)
: cell.getIsPlaceholder() ? null
: renderNormalCell(cell)
rowAggregationFeature (previous chapter) when groups need aggregate values.groupedColumnMode decides whether grouped columns physically move to the front, disappear, or stay put — pick deliberately, it changes what columnOrder ends up meaning.