Documentation

@kanunilabs/pivotgrid-react


@kanunilabs/pivotgrid-react / PivotGridRef

Interface: PivotGridRef

The imperative handle a ref on the grid receives.

Extends

  • PivotGridRef

Properties

applyPersistedState

applyPersistedState: (state) => boolean

Put a getPersistedState snapshot back: fields, areas, sorting, filters, open members, totals, calculated fields, chart type, column widths. False, and nothing changed, when it cannot be read (another version).

Parameters

state

unknown

Returns

boolean


applyTransaction

applyTransaction: (transaction) => PivotTransactionResult

Add, update and remove rows without rebuilding the pivot (live updates). Rows are matched by the rowKey prop (by object identity without it); an update for an unknown key is ignored, a remove wins over an update of the same row, adds go to the end. Returns what was applied; the recomputed pivot follows asynchronously.

Parameters

transaction

PivotRowTransaction<any>

Returns

PivotTransactionResult


applyTransactionAsync

applyTransactionAsync: (transaction, callback?) => void

Queue a transaction; queued ones are merged and applied together after the asyncTransactionWait prop's milliseconds (default 50) — for a feed that ticks many times a second. The callback runs when its batch landed.

Parameters

transaction

PivotRowTransaction<any>

callback?

() => void

Returns

void


collapseAll

collapseAll: () => void

Returns

void

Inherited from

CorePivotGridRef.collapseAll


expandAll

expandAll: () => void

Returns

void

Inherited from

CorePivotGridRef.expandAll


exportData

exportData: (format, options?) => Promise<void>

Returns a promise so a caller can handle a refusal.

It used to be void. That was harmless while an unavailable format was a console.warn and a resolved promise; the controller now REJECTS for the three Enterprise formats, and a void return meant the caller could not catch it even if they wanted to. Widening void to Promise<void> is source-compatible — existing callers ignore the return either way.

Parameters

format

string

options?

ExportOptions

Returns

Promise<void>

Inherited from

CorePivotGridRef.exportData


flushAsyncTransactions

flushAsyncTransactions: () => void

Apply the queued transactions now.

Returns

void


getCell

getCell: (rowPath, colPath) => PivotCell<any> | null

Parameters

rowPath

string[]

colPath

string[]

Returns

PivotCell<any> | null

Inherited from

CorePivotGridRef.getCell


getController

getController: () => PivotController<any>

The controller behind the grid — for the calls that take one, such as the Enterprise AI layout functions (getPivotAiSchema(ref.current.getController())). The vanilla grid hands out the same object as api.controller.

Returns

PivotController<any>


getEngineResult

getEngineResult: () => PivotEngineResult | null

Returns

PivotEngineResult | null

Inherited from

CorePivotGridRef.getEngineResult


getPersistedState

getPersistedState: (options?) => PersistedPivotState

Everything the reader arranged, as versioned plain JSON — what stateStoring saves. Keep it anywhere (a tab cache, IndexedDB, a server) and hand it back to applyPersistedState.

Parameters

options?
include?

readonly "scroll"[]

Returns

PersistedPivotState


getRawData

getRawData: () => unknown[]

Returns

unknown[]

Inherited from

CorePivotGridRef.getRawData


getState

getState: () => PivotControllerState

Returns

PivotControllerState

Inherited from

CorePivotGridRef.getState


refreshEngine

refreshEngine: () => void

Returns

void

Inherited from

CorePivotGridRef.refreshEngine


setColumnWidths

setColumnWidths: (widths) => void

Replaces the stored column widths — the same map a resize drag writes, persisted with the layout. Keys are row-<i> and leaf-<i>; see PivotControllerState.columnWidths. Columns left out go back to defaultColumnWidths, so merge with getState().columnWidths to change one column and keep the rest.

Parameters

widths

Record<string, number>

Returns

void


setFields

setFields: (fields) => void

Parameters

fields

PivotField<any, PivotCellTemplate, any>[]

Returns

void

Inherited from

CorePivotGridRef.setFields


setSearchText

setSearchText: (text) => void

Quick search: show only the row members whose caption contains text (ignoring case and accents), with the members above them. '' clears it. Works with or without the search box.

Parameters

text

string

Returns

void