Documentation

@kanunilabs/datagrid-react


@kanunilabs/datagrid-react / SummaryDef

Interface: SummaryDef<TRow>

Type Parameters

TRow

TRow = GridRowData

Properties

calculate?

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

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


dependsOnOrder?

optional dependsOnOrder?: boolean

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

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


valueFormatter?

optional valueFormatter?: (value) => string

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

Parameters

value

number | null

Returns

string