Documentation

@kanunilabs/datagrid-react


@kanunilabs/datagrid-react / GridViewState

Interface: GridViewState

Everything the user can change, in a JSON-safe shape. version exists so a view saved by an older build can be rejected (or migrated) rather than silently applied against a changed schema.

Properties

calculatedColumns?

optional calculatedColumns?: CalculatedColumnSpec[]

Calculated columns the USER added at runtime (G-CORE-01, Enterprise). Columns defined with a formula in the configuration are not listed — they come from the code. Their width and position are in columns like any column's.


collapsedBands?

optional collapsedBands?: string[][]

Column bands the user folded, as caption paths, outermost first.


collapsedGroups

collapsedGroups: string[]


columnFilterParts?

optional columnFilterParts?: Record<string, Record<string, FilterNode>>

WHICH SURFACE contributed each condition — the filter row, the header popup, or an unnamed programmatic call (P3.7).

columnFilters above is the effective per-column filter and stays the authority; this is the breakdown that lets each surface show its own work again after a restore. Without it a restored view left the popup's ticks and the filter row's text both blank while the rows were plainly filtered.

Optional: a view saved before parts existed carries only the combined condition, and restoreView rebuilds a single unnamed part from it.


columnFilters

columnFilters: Record<string, FilterNode>


columns

columns: ColumnState[]


details?

optional details?: RowKey[]

SESSION state (include: ['details']): the master rows whose detail panel was toggled from the default — open ones, or with masterDetail.expandedByDefault the closed ones — by key. Without it a restore closes every panel (Tekax, 2026-10-15: a tab rebuilt from its state should look as it was left).


filter

filter: FilterNode | null


filterEnabled?

optional filterEnabled?: boolean

Whether the filter was being APPLIED. Optional so a view saved before this existed restores as enabled, which is what it was.


focusedCell?

optional focusedCell?: { columnId: string; rowKey: RowKey; } | null


groupBy

groupBy: string[]

Grouping levels, outermost first.


groupSummaries?

optional groupSummaries?: boolean

Per-group aggregates on or off (the header menu's "group footers").


page

page: number


pageSize

pageSize: number


parts?

optional parts?: Record<string, unknown>

State kept by layers above the core, by name — the Enterprise chart panel keeps its chart under chart. Absent when nothing registered a part. Restoring a view whose part has no owner yet holds it until one registers (see DataGridController.registerViewStatePart).


pinnedRows?

optional pinnedRows?: PinnedRowKeys

Rows the user pinned (G-CORE-05), by key, in pinned order. Saved by default: a pin is an arrangement the user made, like a column width. A key the data no longer has is dropped on restore.


remoteGroups?

optional remoteGroups?: object

Which server-side groups are open: the default and the paths flipped from it, as expandAllGroups() and the toggles left them. Remote grouping only.

expandedByDefault

expandedByDefault: boolean

toggled

toggled: string[]


scroll?

optional scroll?: object

Pixels, restored once the rows are there.

left

left: number

top

top: number


searchText

searchText: string


selection?

optional selection?: SelectionDescriptor

SESSION state — only in a snapshot that asks for it with getViewState({ include }) (or stateStoring.include): what was selected, the focused cell, and the scroll offsets. Left out by default because it describes the rows of a moment: yesterday's selection restored over today's data can select rows nobody chose today.


sort

sort: SortDescriptor[]


summaries?

optional summaries?: object[]

The footer aggregations (P-STATE-01, 2026-10-09): what the footer menu switched a column to, or removed. custom ones are not listed — their reducer is a function — and survive a restore from the configuration. Absent on a view saved before; the configured ones then stay.

columnId

columnId: string

type

type: "sum" | "avg" | "min" | "max" | "count" | "countDistinct"


tree?

optional tree?: object

Which tree rows are open (tree-data grids only): the default, and the rows toggled away from it — the same small set the grid keeps, so a tree of 50.000 rows does not save 50.000 keys. Absent on a flat grid, and on a view saved before trees were remembered (which restores with the configured default).

expandedByDefault

expandedByDefault: boolean

toggled

toggled: RowKey[]


version

version: 1