TanStack

TableOptions_Rows

Interface: TableOptions_Rows<TFeatures, TData>

Defined in: core/rows/coreRowsFeature.types.ts:107

Extended by

Type Parameters

TFeatures

TFeatures extends TableFeatures

TData

TData extends RowData

Properties

getRowId()?

ts
optional getRowId: (originalRow, index, parent?) => string;

Defined in: core/rows/coreRowsFeature.types.ts:115

This optional function is used to derive a unique ID for any given row. If not provided the row's index is used (nested rows join together with . using their grandparents' index e.g. index.index.index). If you need to identify individual rows that are originating from any server-side operations, it's suggested you use this function to return an ID that makes sense regardless of network IO/ambiguity e.g. a userId, taskId, database ID field, etc.

Parameters

originalRow

TData

index

number

parent?

Row<TFeatures, TData>

Returns

string

Example

ts
getRowId: row => row.userId

getSubRows()?

ts
optional getSubRows: (originalRow, index) => readonly TData[] | undefined;

Defined in: core/rows/coreRowsFeature.types.ts:124

This optional function is used to access the sub rows for any given row. If you are using nested rows, you will need to use this function to return the sub rows object (or undefined) from the row.

Parameters

originalRow

TData

index

number

Returns

readonly TData[] | undefined

Example

ts
getSubRows: row => row.subRows