Core Concepts
NextGrid separates static configuration from mutable runtime state and keeps every mutation atomic. Understanding these core concepts makes advanced features predictable.
Column Definitions vs. Column State
Section titled “Column Definitions vs. Column State”columnDefsdescribe schema and behavior (key,valueGetter,formatter,isSortable,cellEditor).ColumnStateholds runtime user layout (width,isVisible,pinned,flex, display order) exposed bygetColumnState().
When you call setColumnDefs(nextDefs), NextGrid matches kept columns by colId so user widths, pins, visibility, and order survive schema updates.
Source Index vs. Display Index vs. Row ID
Section titled “Source Index vs. Display Index vs. Row ID”sourceIndex: A row’s0-based index in the originalrowDataorrowSource.displayIndex: A row’s current visual position after filtering, sorting, pagination, grouping, or tree expansion.rowId: The stable string returned bygetRowId,rowKey, orgenerateRowId.
APIs accept RowAddress ({ rowId } or { displayIndex }). Persistent selection and detail expansion always track rowId (never displayIndex) so reordering data never selects the wrong row.
Row Identity & Data Epochs
Section titled “Row Identity & Data Epochs”Every dataset replacement (setRowData, setRowSource) starts a new dataEpoch string. Stale edits, async row transactions, or clipboard operations captured under an older epoch are rejected safely instead of writing into a newly loaded row. See Row Identity & Epochs.
State, Events & source
Section titled “State, Events & source”Every event in GridEventMap carries:
source:'api' | 'ui' | 'stateRestore' | 'datasource'so listeners can distinguish user clicks from programmatic updates and avoid feedback loops.state: the committed v5GridStatesnapshot.- Monotonic counters (
transactionVersion,modelVersion,layoutVersion,focusVersion,selectionVersion).
Atomic Transactions
Section titled “Atomic Transactions”State updates (applyState, setColumnDefs, applyRowTransaction, setCellSpans, setHierarchyOptions) validate all invariants before publishing. If validation fails, the grid throws and leaves its prior committed state untouched—never half-applied.
Construction-Only vs. Runtime-Mutable Options
Section titled “Construction-Only vs. Runtime-Mutable Options”Options such as density, direction, localeText, rowHeight, rowOverscan, modules, and rowModelType are read once at construction. Options with setters (columnDefs, rowData, theme, pivot, pinnedRows, cellSpans, etc.) update the live grid without recreating DOM pools. See the Mutable via column in GridOptions.
Modularity (next-grid-js vs next-grid-js/core)
Section titled “Modularity (next-grid-js vs next-grid-js/core)”next-grid-js bundles all features. next-grid-js/core omits optional modules (ExportModule, ClipboardModule) so applications register only what they need per instance via modules. See Entries & Modules.