MCPcopy Index your code
hub / github.com/TanStack/table / getExpandedRowModel

Function getExpandedRowModel

packages/table-core/src/utils/getExpandedRowModel.ts:4–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { getMemoOptions, memo } from '../utils'
3
4export function getExpandedRowModel<TData extends RowData>(): (
5 table: Table<TData>
6) => () => RowModel<TData> {
7 return table =>
8 memo(
9 () => [
10 table.getState().expanded,
11 table.getPreExpandedRowModel(),
12 table.options.paginateExpandedRows,
13 ],
14 (expanded, rowModel, paginateExpandedRows) => {
15 if (
16 !rowModel.rows.length ||
17 (expanded !== true && !Object.keys(expanded ?? {}).length)
18 ) {
19 return rowModel
20 }
21
22 if (!paginateExpandedRows) {
23 // Only expand rows at this point if they are being paginated
24 return rowModel
25 }
26
27 return expandRows(rowModel)
28 },
29 getMemoOptions(table.options, 'debugTable', 'getExpandedRowModel')
30 )
31}
32
33export function expandRows<TData extends RowData>(rowModel: RowModel<TData>) {
34 const expandedRows: Row<TData>[] = []

Callers 8

AppFunction · 0.85
AppFunction · 0.85
TableFunction · 0.85
AppFunction · 0.85
AppComponentClass · 0.85
AppComponentClass · 0.85
AppComponentClass · 0.85

Calls 3

memoFunction · 0.90
getMemoOptionsFunction · 0.90
expandRowsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…