Table rendering
Render the table's current output after enabled features process the data.
TanStack · Type Alias
RowModel is the processed table-row result used by TanStack Table. It provides hierarchical rows, flattened rows, and an ID-keyed row lookup.
RowModel describes the result produced by TanStack Table's row-model pipeline. It exposes the current rows, a flattened version including sub-rows, and an ID-keyed lookup object for efficient row access.
type RowModel<TData> = {
rows: Row<TData>[]
flatRows: Row<TData>[]
rowsById: Record<string, Row<TData>>
}An object with rows, flatRows, and rowsById collections.
import type { RowModel, RowData } from '@tanstack/table-core'
type Person = { name: string }
declare const model: RowModel<Person>
const visibleRows = model.rows
const allRows = model.flatRows
const byId = model.rowsById
console.log(visibleRows, allRows, byId)Reads the three row collections exposed by a row model.
Render the table's current output after enabled features process the data.
Iterate through nested data as one collection.
Retrieve a row directly when its identifier is known.
A RowModel contains rows, flatRows, and rowsById. The rows array preserves the hierarchical structure, flatRows removes nesting, and rowsById supports lookup by row ID.
Follow-up: When would flatRows be preferable? It is useful when an operation must process every nested row as one flat collection.
The final row model is produced after the enabled row-model stages process the data. The documented pipeline can include filtering, grouping, sorting, expanding, and pagination before getRowModel returns the result.
Follow-up: Why should rendering normally use getRowModel? Because it represents the final output after the applicable feature transformations.
rowsById is an object keyed by row ID, enabling direct row retrieval without scanning the rows array. rows and flatRows serve hierarchical traversal and flattened traversal respectively.
Follow-up: What determines whether nested rows appear in flatRows? The row model's generated sub-row structure; flatRows includes those sub-rows at the top level.
RowRowDatagetCoreRowModelgetRowModelcreateFilteredRowModelcreateSortedRowModelcreateGroupedRowModelcreateExpandedRowModel