Documentation

@kanunilabs/datagrid-react


@kanunilabs/datagrid-react / SummaryDef

Interface: SummaryDef<TRow>

Defined in: datagrid-core/dist/index.d.ts:779

Type Parameters

TRow

TRow = GridRowData

Properties

calculate?

optional calculate?: (cells) => number | null

Defined in: datagrid-core/dist/index.d.ts:790

The reducer for type: 'custom'. Receives every DATA cell of the column in view order — group headers are already filtered out — and returns the number to show, or null for "nothing to total".

A weighted average, a variance, a count of rows matching a predicate: all the things a fixed six-reducer set cannot express.

Parameters

cells

readonly SummaryCell<TRow>[]

Returns

number | null


columnId

columnId: string

Defined in: datagrid-core/dist/index.d.ts:780


dependsOnOrder?

optional dependsOnOrder?: boolean

Defined in: datagrid-core/dist/index.d.ts:802

Whether this custom reducer's answer can change when only the ORDER of the rows changes (perf, 2026-08-14). Default true — the safe reading of "receives cells in view order", and exactly the old behaviour.

Most customs are order-blind (a weighted average, a variance, a conditional count); declaring false lets the grid reuse their result when a sort merely rearranges the same rows. Measured on the 1M bench: an order-blind custom re-ran on every sort at ~1.5 s a pass — for an answer that could not have moved.


label?

optional label?: string

Defined in: datagrid-core/dist/index.d.ts:809

Label shown next to the value in the footer. Defaults to the type's name; required in practice for custom, where "Custom" says nothing.


type

type: SummaryType

Defined in: datagrid-core/dist/index.d.ts:781


valueFormatter?

optional valueFormatter?: (value) => string

Defined in: datagrid-core/dist/index.d.ts:804

Display formatting for the footer; falls back to the column's formatter.

Parameters

value

number | null

Returns

string