Read source rows
Use the initial, unprocessed rows when a table also has filtering, sorting, grouping, expansion, or pagination enabled.
TanStack · Function
getCoreRowModel provides TanStack Table's unmodified starting row model. It maps the table's original data into rows before other row-model features process them.
In the current TanStack Table documentation, getCoreRowModel is the factory used to provide a table's basic row model. The model preserves the original data's one-to-one row mapping before filtering, grouping, sorting, expansion, or pagination are applied.
function table_getCoreRowModel<TFeatures, TData>(table): RowModel<TFeatures, TData>;| Name | Type | Description |
|---|---|---|
table | Table_Internal<TFeatures, TData> | The internal table instance whose core row model is resolved. |
RowModel<TFeatures, TData>
import { createTable } from '@tanstack/table-core'
import { getCoreRowModel } from '@tanstack/table-core'
const table = createTable({
data: [{ id: 1, name: 'Ada' }],
columns: [{ accessorKey: 'name', header: 'Name' }],
getCoreRowModel: getCoreRowModel(),
})
const rows = table.getCoreRowModel().rowsCreates a table with the core row-model factory enabled, then reads the unprocessed rows.
Use the initial, unprocessed rows when a table also has filtering, sorting, grouping, expansion, or pagination enabled.
Configure an adapter-style table that expects a core row-model option.
Inspect data before downstream row-model transformations are applied.
getCoreRowModel supplies the table's unmodified core row model. It represents the original table data before other row-model processing is applied.
Follow-up: How does it differ from getRowModel? getRowModel is the final model after enabled processing features, whereas the core model is the unprocessed starting point.
In the documented adapter-style API, it is passed as getCoreRowModel: getCoreRowModel(). The resulting core model is a basic one-to-one mapping of the data supplied to the table.
Follow-up: What should be used to inspect the final displayed rows? Use table.getRowModel(), because later enabled models can transform the core rows.
The core model is the first stage in the row-model pipeline. Filtering, grouping, sorting, expansion, and pagination can then process its output when those features are enabled.
Follow-up: Why inspect the core model instead of the final model? Use it when you need rows unaffected by those transformations, such as an unfiltered source view.
RowModelgetFilteredRowModelgetGroupedRowModelgetSortedRowModel