Pass GridOptions<T> to new Grid<T>(options). Options marked construction only cannot be changed on an existing instance without creating a new grid (framework adapters warn in development when those props change).
GridOptions<T> enforces three compile-time and runtime invariants:
- Data Source Strategy (pick at most one):
rowData (client array)
rowSource (synchronous lazy/direct RowSource<T>)
rowModelType: 'infinite' | 'serverSide' + datasource (optional remoteOptions)
rowModelType: 'viewport' + viewportDatasource (optional viewportOptions)
- Row Identity Required for Selection: Enabling
rowSelection or cellSelection requires one of getRowId, rowKey, generateRowId, or rowSource.getRowId.
- Hierarchy Exclusivity:
rowGrouping and treeData are mutually exclusive inside HierarchyOptions<T>.
- Type:
HTMLElement · Default: required · Mutability: construction only · Guide: Installation
- Host DOM element where
.grid-container is mounted
- Type:
readonly GridModule[] · Default: [] (all in root) · Mutability: construction only · Guide: Entries & Modules
- Per-instance feature modules for
next-grid-js/core (ExportModule, ClipboardModule)
- Type:
readonly ColumnDef<T>[] · Default: required · Mutability: mutable via setColumnDefs · Guide: Column Definitions
- Leaf column definitions (
DataColumnDef or ComputedColumnDef)
- Type:
Readonly<BaseColumnDef<T>> · Default: undefined · Mutability: mutable via setColumnDefs · Guide: Columns & Layout
- Shared defaults merged into every column definition
- Type:
readonly ColumnGroupDef[] · Default: [] · Mutability: mutable via setColumnDefs · Guide: Columns & Layout
- Nested static header column groups
- Type:
'auto' | 'light' | 'dark' · Default: 'auto' · Mutability: mutable via setTheme · Guide: Theming
- Color theme (
'auto' follows ancestor theme classes, then OS preference)
- Type:
'default' | 'compact' · Default: 'default' · Mutability: construction only · Guide: Theming
- Density preset (
'compact' uses 22 px body / 26 px header rows)
- Type:
'ltr' | 'rtl' · Default: 'ltr' · Mutability: construction only · Guide: Columns & Layout
- Logical layout direction (
'start'/'end' pinning and scroll)
- Type:
GridLocaleTextOption · Default: en · Mutability: construction only · Guide: Entries & Modules
- Complete/partial dictionary (for example
ru from next-grid-js/locale/ru) or resolver function
- Type:
string · Default: undefined · Mutability: construction only · Guide: Keyboard & Accessibility
- Accessible label on the
role="grid" root
- Type:
string · Default: undefined · Mutability: construction only · Guide: Keyboard & Accessibility
- ID reference for the
role="grid" root accessible name
- Type:
Readonly<GridStatePatch> · Default: undefined · Mutability: mutable via applyState · Guide: GridState
- Initial state snapshot (
version: 1..5) applied at construction
- Type:
GridDiagnosticsOptions · Default: undefined · Mutability: construction only · Guide: Diagnostics & Errors
- Per-frame render telemetry callback (
{ onFrame })
- Type:
readonly T[] · Default: [] · Mutability: mutable via setRowData, applyRowTransaction · Guide: Data Models
- Owned client-side row array
- Type:
RowSource<T> · Default: undefined · Mutability: mutable via setRowSource · Guide: Virtualization
- Synchronous lazy/direct row source for 1M+ rows
- Type:
'infinite' | 'serverSide' | 'viewport' · Default: undefined · Mutability: construction only · Guide: Remote Data
- Async or live push row model strategy
- Type:
RemoteDatasource<T> · Default: undefined · Mutability: mutable via setRemoteDatasource · Guide: Remote Data
- Block-fetching datasource for
'infinite' and 'serverSide'
- Type:
Readonly<RemoteDataOptions> · Default: undefined · Mutability: mutable via setDatasourceContext · Guide: Remote Data
- Block size, cache capacity, concurrency, prefetch, retries, and initial context
- Type:
ViewportDatasource<T> · Default: undefined · Mutability: mutable via setViewportDatasource · Guide: Remote Data
- Live viewport push datasource for
'viewport'
- Type:
Readonly<ViewportDataOptions> · Default: undefined · Mutability: mutable via setDatasourceContext · Guide: Remote Data
- Initial row count and context for
'viewport'
- Type:
(row: T, sourceIndex: number) => string · Default: undefined · Mutability: construction only · Guide: Row Identity & Epochs
- Function returning a unique, stable row ID
- Type:
keyof T | readonly (keyof T)[] · Default: undefined · Mutability: construction only · Guide: Row Identity & Epochs
- Property key (or composite key list) used as row ID
- Type:
'uuid' | 'index' · Default: undefined · Mutability: construction only · Guide: Row Identity & Epochs
- Built-in row ID generator when source rows lack an ID field
- Type:
number · Default: 26 (22 in compact) · Mutability: construction only · Guide: Virtualization
- Uniform body row height in px; overrides
density
- Type:
number · Default: 30 (26 in compact) · Mutability: construction only · Guide: Theming
- Height of one header row in px; grouped headers stack per level
- Type:
false | Readonly<RowHeightOptions<T>> · Default: false · Mutability: mutable via resetRowHeights · Guide: Advanced Layout
- Per-row height estimation and intrinsic DOM measurement
- Type:
Readonly<RowHeightBounds> · Default: { min: 8, max: 100000 } · Mutability: construction only · Guide: Limits
- Allowed min/max row height bounds in px
- Type:
number · Default: 3 · Mutability: construction only · Guide: Virtualization
- Extra pooled rows rendered above and below the viewport
- Type:
number · Default: 2 · Mutability: construction only · Guide: Virtualization
- Extra pooled columns rendered outside the horizontal viewport
- Type:
number · Default: 120 · Mutability: construction only · Guide: Columns & Layout
- Minimum center scroll viewport width before pinning guards activate
- Type:
number · Default: 80 · Mutability: construction only · Guide: Columns & Layout
- Minimum center body height guarded against pinned row overflow
| Option |
Default |
Mutability |
rowSelection |
false |
setRowSelected, selectAllRows |
cellSelection |
false |
setCellRange, clearCellSelection |
columnMenu |
built-in items |
construction only |
bodyMenu |
clipboard + export defaults |
construction only |
clipboard |
false |
construction only |
fill |
false |
construction only |
history |
false |
undo, redo, clearHistory |
dataExport |
false |
exportData, downloadExport |
- Type:
false | Readonly<RowSelectionOptions> · Default: false · Mutability: mutable via setRowSelected, selectAllRows · Guide: Selection & Editing
- Single/multiple row selection and checkbox placement
- Type:
false | Readonly<CellSelectionOptions> · Default: false · Mutability: mutable via setCellRange, clearCellSelection · Guide: Selection & Editing
- Single or multi-range cell selection
- Type:
false | Readonly<ColumnMenuOptions<T>> · Default: built-in items · Mutability: construction only · Guide: Columns & Layout
- Custom header menu (
getItems or getMenuItems) or false to disable
- Type:
false | Readonly<BodyMenuOptions<T>> · Default: clipboard + export defaults · Mutability: construction only · Guide: Selection & Editing
- Body context menu (
getMenuItems) or false for native menu
- Type:
false | Readonly<ClipboardOptions> · Default: false · Mutability: construction only · Guide: Selection & Editing
- Copy/cut/paste budgets and
copyMode (requires ClipboardModule on ./core)
- Type:
false | Readonly<FillOptions> · Default: false · Mutability: construction only · Guide: Selection & Editing
- Drag-fill handle and max cell limit
- Type:
false | Readonly<HistoryOptions> · Default: false · Mutability: mutable via undo, redo, clearHistory · Guide: Selection & Editing
- Undo/redo stack depth and memory budgets
- Type:
false | Readonly<DataExportOptions> · Default: false · Mutability: mutable via exportData, downloadExport · Guide: Data Export
- Opt-in footer Export control and
bodyMenu export formats (ExportModule on ./core)
- Type:
Readonly<RowGroupingOptions<T>> · Default: undefined · Mutability: mutable via setRowGrouping, setHierarchyOptions · Guide: Hierarchy & Pivot
- Column grouping configuration (
columns, keyGetter, autoColumn)
- Type:
Readonly<TreeDataOptions<T>> · Default: undefined · Mutability: mutable via setHierarchyOptions · Guide: Hierarchy & Pivot
- Path (
getDataPath) or nested (getChildren) tree hierarchy
- Type:
readonly Readonly<ValueAggregation>[] · Default: [] · Mutability: mutable via setHierarchyOptions · Guide: Hierarchy & Pivot
- Aggregated measure columns and
aggFunc names
- Type:
Readonly<Record<string, Readonly<AggregateDefinition>>> · Default: built-ins · Mutability: mutable via setHierarchyOptions · Guide: Hierarchy & Pivot
- Custom aggregation functions and incremental accumulators
- Type:
'filtered' | 'all' · Default: 'filtered' · Mutability: mutable via setHierarchyOptions · Guide: Hierarchy & Pivot
- Whether aggregates compute over filtered or all source rows
- Type:
boolean · Default: false · Mutability: mutable via setHierarchyOptions · Guide: Hierarchy & Pivot
- Adds synthetic group total rows inside expanded branches
- Type:
boolean · Default: false · Mutability: mutable via setHierarchyOptions · Guide: Hierarchy & Pivot
- Adds a synthetic grand total row
- Type:
number | 'all' · Default: 0 · Mutability: mutable via setHierarchyOptions · Guide: Hierarchy & Pivot
- Initial group/tree expansion depth
- Type:
(params: Readonly<AggregateFormatterParams>) => string · Default: undefined · Mutability: mutable via setHierarchyOptions · Guide: Hierarchy & Pivot
- Formats computed aggregate cell values
- Type:
false | Readonly<PivotOptions> · Default: false · Mutability: mutable via setPivot · Guide: Hierarchy & Pivot
- Client or server pivot matrix configuration
- Type:
number · Default: 256 · Mutability: mutable via setPivotColumnLimit · Guide: Hierarchy & Pivot
- Maximum generated pivot result columns (
1..4096)
- Type:
Readonly<Record<string, Readonly<AggregateDefinition>>> · Default: built-ins · Mutability: construction only · Guide: Hierarchy & Pivot
- Custom aggregate functions for pivot measures
- Type:
(params: Readonly<PivotValueFormatterParams>) => string · Default: undefined · Mutability: construction only · Guide: Hierarchy & Pivot
- Formatter for pivot result cells
- Type:
Readonly<PivotGroupColumnOptions> · Default: undefined · Mutability: construction only · Guide: Hierarchy & Pivot
- Auto group column overrides in pivot mode
- Type:
(params: Readonly<PivotKeyParams<T>>) => HierarchyKeyValue · Default: undefined · Mutability: construction only · Guide: Hierarchy & Pivot
- Custom key extractor for pivot grouping/column dimensions
- Type:
Readonly<DetailOptions<T>> · Default: undefined · Mutability: mutable via setDetailExpanded · Guide: Advanced Layout
- Master/Detail row expansion and renderer lifecycle
- Type:
(params: Readonly<RealRowParams<T>>) => boolean · Default: undefined · Mutability: construction only · Guide: Advanced Layout
- Predicate identifying full-width rows
- Type:
FullWidthRenderer<T> · Default: undefined · Mutability: construction only · Guide: Advanced Layout
- Renderer for full-width rows
- Type:
{ estimatedHeight?: number; measureHeight?: boolean } · Default: { measureHeight: true } · Mutability: mutable via resetRowHeights · Guide: Advanced Layout
- Height estimation and intrinsic measurement for full-width rows
- Type:
{ top?: readonly PinnedRow<T>[]; bottom?: readonly PinnedRow<T>[] } · Default: undefined · Mutability: mutable via setPinnedRows, clearPinnedRows · Guide: Advanced Layout
- Supplied top and bottom pinned rows
- Type:
false | Readonly<PinnedTotalsOptions> · Default: false · Mutability: mutable via setPinnedTotals · Guide: Advanced Layout
- Projected top/bottom aggregate total rows
- Type:
readonly Readonly<CellSpan>[] · Default: [] · Mutability: mutable via setCellSpans · Guide: Advanced Layout
- Initial rectangular cell spans
Every on* option registers a listener equivalent to grid.addEventListener(...) at construction time. See Events for full payloads.
| Option |
Event Type |
Notes |
onSortChanged |
sortChanged |
Fires when sort model changes |
onColumnStateChanged |
columnStateChanged |
Fires on width, visibility, order, pin, or setColumnDefs changes |
onFilterChanged |
filterChanged |
Fires when column filters or quick filter change |
onPaginationChanged |
paginationChanged |
Fires when page, page size, or enabled state changes |
onStateChanged |
stateChanged |
Fires after committed state-mutating transactions |
onModelUpdated |
modelUpdated |
Fires when displayed/total row counts update |
onProcessingChanged |
processingChanged |
Reserved — not emitted by the synchronous pipeline |
onFocusChanged |
focusChanged |
Fires when logical focus moves |
onSelectionChanged |
selectionChanged |
Fires when row or cell range selection changes |
onError |
error |
Fires on contained callback, menu, clipboard, export, or datasource errors |
onDatasourceChanged |
datasourceChanged |
Fires when remote/viewport block or connection state updates |
onHierarchyChanged |
hierarchyChanged |
Fires when grouping, tree, or expansion state changes |
onPivotChanged |
pivotChanged |
Fires when pivot configuration or pivot expansion changes |
onPinnedRowsChanged |
pinnedRowsChanged |
Fires when supplied pinned rows or pinned totals change |
onCellSpansChanged |
cellSpansChanged |
Fires when active or suppressed cell spans change |