Documentation

@kanunilabs/pivotgrid-react


@kanunilabs/pivotgrid-react / PivotRowSource

Interface: PivotRowSource<TRow>

Rows to read page by page — the same in both modes, so one code path serves a columnar grid and an ordinary one (B.111, a customer's Selection Details panel). rowAt is the cheap read: in a columnar grid it is ONE read-only row object moved to row index (valid until the next call — read values, keep nothing); in an ordinary grid it is the row itself. getRows builds plain rows. A source keeps the rows it was made from: isStale() says the grid's rows have changed since (rows added, or new data); make a new source to see them.

Type Parameters

TRow

TRow = Record<string, unknown>

Properties

columns

readonly columns: readonly string[]

Column names, in store order (columnar) or as the first rows have them (ordinary grid).


rowCount

readonly rowCount: number

Methods

forEachRow()

forEachRow(fn, start?, end?): void

Parameters

fn

(row, index) => void

start?

number

end?

number

Returns

void


getRows()

getRows(start, end): TRow[]

Parameters

start

number

end

number

Returns

TRow[]


isStale()

isStale(): boolean

Returns

boolean


rowAt()

rowAt(index): Readonly<TRow>

Parameters

index

number

Returns

Readonly<TRow>


toRowArray()

toRowArray(): TRow[]

Every row as an object to keep — for a DataGrid's data (its client row model holds every row object; a customer's Selection Details panel). In a columnar grid each is a small row HANDLE (about 40 bytes): its columns are getters that read the pivot's store, so sorting, filtering, the header filter, Excel export, range selection totals and copy work as over plain rows, with no row object built. Object.keys(handle) and { ...handle } are empty (use getRows or JSON.stringify for a plain row), a write stays on the handle. In an ordinary grid: the rows themselves. A new array per call.

Returns

TRow[]