Modernize grouping configuration
Migrating legacy v8-compatible table code to the current feature-based API.
TanStack · Function
getGroupedRowModel is a deprecated TanStack Table v8 compatibility stub that enables the grouped row model. For current Table APIs, use createGroupedRowModel() in the groupedRowModel feature slot.
In the current Table API, grouping is configured by registering a grouped-row-model factory in the table's feature slots. The resulting table instance exposes a grouped row model that transforms rows according to grouping state; aggregation can also be applied when the aggregation feature is registered.
function getGroupedRowModel<TData>(): RowModelFactory<TData>;RowModelFactory<TData>
import { createGroupedRowModel } from '@tanstack/table-core'
const features = tableFeatures({
columnGroupingFeature,
groupedRowModel: createGroupedRowModel(),
})Register the grouping feature and its row-model factory in the table features.
Migrating legacy v8-compatible table code to the current feature-based API.
Grouping client-side data according to the table's grouping state.
Computing aggregate values for grouped rows.
In the current API, the legacy function is replaced by createGroupedRowModel() registered in the groupedRowModel feature slot. The table then exposes the grouped row model through its instance.
Follow-up: How does server-side grouping differ? Set manualGrouping to true and supply already-grouped rows; the table will not perform client-side grouping.
The grouped row model groups rows according to grouping state and can compute aggregate values when the row aggregation feature is also registered. It is one stage in the table's row-model pipeline.
Follow-up: What follows grouping in the pipeline? Sorting, expansion, pagination, and finally the table's final row model can run afterward.
The legacy signature is getGroupedRowModel<TData>(): RowModelFactory<TData>. Its return type is RowModelFactory<TData>, but the page marks it deprecated and recommends the newer factory.
Follow-up: Why should new code avoid it? It exists only for v8 compatibility with useLegacyTable, while the current API uses feature-based factories.
createGroupedRowModelgroupedRowModelcolumnGroupingFeaturerowAggregationFeaturemanualGroupingtable.getGroupedRowModel()table.getPreGroupedRowModel()