GridApi
All methods live on the Grid<T> instance (GridApi<T> extends HierarchyApi<T>). Calling mutating or query methods after destroy() throws an explicit destroyed-grid error.
Data & Transactions
Section titled “Data & Transactions”setRowData(rowData: readonly T[]): void— Replaces client row data, creates a newdataEpoch, and emitsmodelUpdatedandstateChanged.setRowSource(rowSource: RowSource<T>): void— Attaches a synchronous lazy/directRowSource<T>, replaces the active source, and emitsmodelUpdated.applyRowTransaction(transaction: Readonly<RowDataTransaction<T>>): Readonly<RowTransactionResult>— Atomically adds, updates, or removes rows byrowIdand emitsrowDataChangedandmodelUpdated. Throws if row identity is not configured or an update targets a missing/duplicate ID.applyRowTransactionAsync(transaction: Readonly<RowDataTransaction<T>>): Promise<Readonly<AsyncRowTransactionResult>>— Queues a row transaction for the next animation-frame batch; resolves with{ status: 'applied' | 'unchanged', ... }or{ status: 'cancelled', reason }ondataEpochChangedordestroy.flushAsyncTransactions(): Promise<Readonly<AsyncRowTransactionResult> | null>— Immediately commits pending queued async transactions or returnsnullif the queue is empty.refreshRows(): void— Marks the current row view dirty and schedules a re-read/re-render without resetting state.getRowAddress(displayIndex: number): Readonly<RealRowAddress> | null— Resolves a visible display index to its stableRealRowAddress(ornullif out of bounds or synthetic/unloaded).
Columns
Section titled “Columns”setColumnDefs(columnDefs: readonly ColumnDef<T>[], options?: Readonly<ColumnDefinitionsUpdate<T>>): void— Atomically replaces column definitions, matching kept columns bycolId. Rejects if a removed column is referenced by active grouping, cell spans, orcheckboxColId, or if columns/order change while pivot is active. EmitscolumnStateChangedandstateChanged.getColumnState(): Readonly<ColumnState>— Returns a serializableversion: 1snapshot of column widths, visibility, pinning, flex, and order.applyColumnState(state: Readonly<ColumnState>): void— Atomically applies a fullColumnStatesnapshot and emitscolumnStateChangedandstateChanged.applyColumnStatePatch(patch: Readonly<ColumnStatePatch>): void— Applies partial column updates (columns, optionalapplyOrder) and emitscolumnStateChangedandstateChanged.resetColumnState(): void— Restores column widths, visibility, pinning, flex, and order back to the currentcolumnDefsdefaults.setColumnWidth(colId: string, width: number): void— Sets an explicit pixel width on a column and emitscolumnStateChanged.setColumnVisibility(colId: string, isVisible: boolean): void— Shows or hides a column and emitscolumnStateChanged.moveColumn(colId: string, targetIndex: number): void— Moves a column totargetIndexwithin its pin zone and emitscolumnStateChanged.setColumnPinned(colId: string, pinned: ColumnPin): void— Pins ('start' | 'end') or unpins (null) a column and emitscolumnStateChanged.setColumnFlex(colId: string, flex: number | null): void— Updates or clears proportionalflexsizing on a column and emitscolumnStateChanged.sizeColumnsToFit(colIds?: readonly string[]): void— Scales center columns (orcolIds) to fill available center viewport width.autoSizeColumns(colIds: readonly string[]): void— Measures rendered/sampled cell text widths forcolIdsand updates widths withinminWidth/maxWidth.
Sort, Filter & Pagination
Section titled “Sort, Filter & Pagination”getSortModel(): SortModel— Returns the activeSortModel(readonly SortModelItem[]).setSortModel(model: SortModel): void— Replaces the active sort model and emitssortChanged,modelUpdated, andstateChanged.getFilterModel(): FilterModel— Returns the active column filter map keyed bycolId.setFilterModel(model: FilterModel): void— Replaces active column filters and emitsfilterChanged,modelUpdated, andstateChanged.setQuickFilter(value: string): void— Updates the global quick filter string and emitsfilterChangedandmodelUpdated.getPaginationState(): Readonly<PaginationState>— Returns{ enabled, page, pageSize }.setPaginationState(state: Readonly<PaginationState>): void— Updates pagination configuration/page index (clamping to valid pages) and emitspaginationChangedandstateChanged.
Selection, Focus & Scrolling
Section titled “Selection, Focus & Scrolling”getSelectionState(): Readonly<SelectionState | SelectionStateV3>— Returns the current row and cell range selection snapshot (SelectionStateV3when pivot mode is active).applySelectionState(state: Readonly<SelectionState | SelectionStateV3>): void— Restores a serialized selection snapshot and emitsselectionChangedandstateChanged.setRowSelected(row: Readonly<RowAddress>, selected: boolean): boolean— Selects or deselects a row byRowAddress; returnsfalseif not found/ineligible. EmitsselectionChanged.isRowSelected(row: Readonly<RowAddress>): boolean— Returnstrueif the target row is currently selected.selectAllRows(scope?: 'filtered' | 'page' | 'all'): void— Selects all eligible rows in'filtered'(default),'page', or'all'scope and emitsselectionChanged.clearRowSelection(): void— Clears all selected rows and emitsselectionChanged.setCellRange(anchor: Readonly<DisplayCellAddress>, focus: Readonly<DisplayCellAddress>, add?: boolean): boolean— Sets (or appends whenaddistrue) a rectangular cell range; returnsfalseif rejected. EmitsselectionChanged.clearCellSelection(): void— Clears all cell ranges and emitsselectionChanged.clearSelection(): void— Clears both row and cell range selections atomically.getFocusPosition(): Readonly<FocusPosition>— Returns the current logical focus target (cell,header,fullWidth,region,pivotResult, ornull).setFocusedCell(cell: Readonly<CellAddress> | null, options?: Readonly<FocusOptions>): boolean— Moves logical focus to a body cell (or clears withnull); returnsfalseif non-focusable. EmitsfocusChanged.setFocusedHeader(colId: string, options?: Readonly<FocusOptions>): boolean— Moves logical focus to a column header; returnsfalseif hidden/missing.setFocusedFullWidthRow(row: Readonly<DisplayNodeOrRowAddress>, options?: Readonly<FocusOptions>): boolean— Moves logical focus to a full-width row.setFocusedRegionCell(address: Readonly<RegionRowAddress | RegionTotalAddress>, colId: string, options?: Readonly<FocusOptions>): boolean— Moves logical focus to a pinned top/bottom row or pinned total cell.setFocusedDisplayCell(cell: Readonly<DisplayCellAddress> | null, options?: Readonly<FocusOptions>): boolean— Moves logical focus to a hierarchy/display node cell.setFocusedPivotCell(cell: Readonly<PivotResultCellAddress> | null, options?: Readonly<FocusOptions>): boolean— Moves logical focus to a pivot result cell.ensureRowVisible(row: Readonly<RowAddress>, alignment?: ScrollAlignment): boolean— Scrolls vertically to revealrow.ensureColumnVisible(colId: string, alignment?: ScrollAlignment): boolean— Scrolls horizontally to revealcolId.ensureCellVisible(cell: Readonly<CellAddress>, alignment?: ScrollAlignment): boolean— Scrolls both axes to revealcell.ensureDisplayNodeVisible(address: Readonly<DisplayNodeAddress>, alignment?: ScrollAlignment): boolean— Scrolls vertically to reveal a hierarchy display node.ensureRegionCellVisible(address: Readonly<RegionRowAddress | RegionTotalAddress>, colId: string): boolean— Scrolls horizontally to reveal a pinned region cell.ensurePivotCellVisible(cell: Readonly<PivotResultCellAddress>): boolean— Scrolls to reveal a pivot result cell.
Editing, History, Clipboard & Fill
Section titled “Editing, History, Clipboard & Fill”startEditing(cell: Readonly<CellAddress>): boolean— Opens an editor oncell; returnsfalseif not editable. EmitseditSessionChanged.getEditSession(): Readonly<EditSession> | null— Returns the active edit session metadata ornull.commitEditing(newValue: unknown): Readonly<CellMutationResult> | null— Validates and commitsnewValue(or emitscellEditRequestfor remote/lazy sources); returnsnullif no session is active.cancelEditing(): boolean— Discards the active edit session without mutating data; returnsfalseif none is active.applyCellChanges(changes: readonly Readonly<CellValueChange>[], options?: Readonly<CellMutationOptions>): Readonly<CellMutationResult>— Runs the full value mutation pipeline over programmatic cell updates; emitscellValuesChangedorcellEditRequest.fillCells(source: Readonly<FillRange>, target: Readonly<FillRange>): Readonly<CellMutationResult> | null— Programmatically fillstargetcells fromsource.getHistoryState(): Readonly<HistoryState>— Returns{ enabled, undoCount, redoCount, retainedRows, retainedCells, version }.canUndo(): boolean/canRedo(): boolean— Returns whether an undo or redo step is available.undo(): Readonly<HistoryResult>/redo(): Readonly<HistoryResult>— Reverts or reapplies the last recorded edit/clipboard/fill batch and emitshistoryChangedandcellValuesChanged.clearHistory(): boolean— Clears the undo/redo stack; returnsfalseif history is disabled.getClipboardText(options?: Readonly<ClipboardCopyOptions>): string | null— Builds quoted TSV text for the current selection/focus (ClipboardModulerequired onnext-grid-js/core). Returnsnullifclipboardis disabled or unavailable.copyToClipboard(options?: Readonly<ClipboardCopyOptions>): Promise<string | null>— Writes selected/focused TSV to the system clipboard (ClipboardModulerequired on./core).cutToClipboard(options?: Readonly<ClipboardCopyOptions>): Promise<Readonly<CellMutationResult> | null>— Copies and clears editable cells (ClipboardModulerequired on./core).pasteFromText(text: string): Readonly<CellMutationResult> | null— Decodes TSVtextand applies edits starting at selection/focus (ClipboardModulerequired on./core).pasteFromClipboard(): Promise<Readonly<CellMutationResult> | null>— Reads the system clipboard and pastes into the grid (ClipboardModulerequired on./core).deleteSelectedCells(): Readonly<CellMutationResult> | null— Clears editable selected/focused cells (ClipboardModulerequired on./core).
Hierarchy & Grouping (HierarchyApi<T>)
Section titled “Hierarchy & Grouping (HierarchyApi<T>)”getDisplayedRowNode(index: number): Readonly<DisplayNode<T>> | undefined— Returns theDisplayNode<T>at displayindex.getGroupingState(): Readonly<HierarchyState>— Returns the serialized hierarchy mode, columns, aggregations, and expansion state.getHierarchyCounts(): Readonly<HierarchyCounts> | null— Returns{ sourceRows, eligibleRows, loadedDataRows, visibleNodes, pageNodes, displayExtent }ornullwhen flat.setRowGrouping(options: Readonly<RowGroupingOptions<T>> | false): void— Enables, updates, or disables column-based row grouping; emitshierarchyChangedandstateChanged.setHierarchyOptions(options: Readonly<HierarchyOptions<T>> | false): void— Atomically replaces grouping or tree options, aggregations, and totals.setGroupExpanded(address: Readonly<DisplayNodeAddress>, expanded: boolean): boolean— Expands or collapses a group/tree node by address.expandAllGroups(): boolean/collapseAllGroups(): boolean— Expands or collapses all client hierarchy branches.setHierarchyMetadataLimit(limit: number): boolean— SetsmaxHierarchyMetadataEntriescap for server-side grouping metadata.
Pivot & Advanced Layout
Section titled “Pivot & Advanced Layout”setPivot(options: false | Readonly<PivotOptions>): void— Enables, updates, or disables pivot mode and emitspivotChangedandstateChanged.getPivotState(): Readonly<PivotState>— Returns current pivot configuration and expansion state.setPivotColumnLimit(limit: number): boolean— Adjusts maximum generated pivot columns (1..4096).getDisplayedPivotNode(index: number): Readonly<PivotResultNode> | undefined— Returns the rendered pivot node atindex.getPivotCounts(): Readonly<PivotCounts> | null— Returns client pivot row/column counts ornull.getServerPivotCounts(): Readonly<ServerPivotCounts> | null— Returns server pivot counts ornull.getPivotRequestState(): Readonly<PivotRequestState>— Returns server pivot request status and error info.setPivotGroupExpanded(row: Readonly<PivotResultRowAddress>, expanded: boolean): boolean— Expands or collapses a pivot row group.setPivotCellRange(anchor: Readonly<PivotResultCellAddress>, focus: Readonly<PivotResultCellAddress>, add?: boolean): boolean— Selects a rectangular range of pivot result cells.setDetailExpanded(row: Readonly<DisplayNodeOrRowAddress>, expanded: boolean): boolean— Expands or collapses a Master/Detail row; emitsdetailChanged.getDetailState(): Readonly<DetailState>— Returns currently expanded detail row addresses.setPinnedRows(region: PinnedRowRegion, rows: readonly Readonly<PinnedRow<T>>[]): void— Replaces'top'or'bottom'supplied pinned rows; emitspinnedRowsChanged.getPinnedRows(region: PinnedRowRegion): readonly Readonly<PinnedRow<T>>[]— Returns supplied pinned rows for'top'or'bottom'.clearPinnedRows(): void— Removes all supplied pinned rows from both regions.setPinnedTotals(options: false | Readonly<PinnedTotalsOptions>): void— Configures or disables projected pinned totals; emitspinnedRowsChanged.setCellSpans(spans: readonly Readonly<CellSpan>[]): void— Replaces rectangular cell spans atomically; emitscellSpansChanged.getCellSpanState(): Readonly<CellSpanState>— Returns active and suppressed cell spans.resetRowHeights(addresses?: readonly RowHeightAddress[]): void— Invalidates cached measured row heights (all or specific addresses) and re-measures.
Remote & Viewport Datasources
Section titled “Remote & Viewport Datasources”getDatasourceState(): Readonly<DatasourceState> | null— Returns live block cache / viewport connection telemetry ornullfor client sources.setRemoteDatasource(datasource: RemoteDatasource<T>): void— Replaces the attachedRemoteDatasource<T>for'infinite'/'serverSide'models and clears cached blocks.setViewportDatasource(datasource: ViewportDatasource<T>): void— Replaces the attachedViewportDatasource<T>for'viewport'models.setDatasourceContext(context: unknown): void— Updates opaquecontextpassed to remote/viewport queries and refreshes data.retryFailedRows(): void— Retries failed remote blocks or failed child hierarchy requests.
Data Export
Section titled “Data Export”exportData<F extends DataExportFormat>(request: Readonly<DataExportRequest & { readonly format: F }>): Promise<Readonly<DataExportResultFor<F>>>— Builds CSV, JSON, Markdown (text), or Excel (bytes: Uint8Array) asynchronously in chunks (ExportModulerequired onnext-grid-js/core). Supportssignal?: AbortSignal.downloadExport<F extends DataExportFormat>(request: Readonly<DataExportRequest & { readonly format: F }>): Promise<Readonly<DataExportResultFor<F>>>— Builds the export and triggers a browser file download (ExportModulerequired on./core).
Theme, State, Events & Lifecycle
Section titled “Theme, State, Events & Lifecycle”getTheme(): GridTheme— Returns the configured theme option ('auto' | 'light' | 'dark').setTheme(theme: GridTheme): void— Switches the active color theme at runtime without recreating the grid or resetting scroll/selection.getState(): Readonly<GridState>— Returns the complete JSON-serializableversion: 5state snapshot.applyState(state: Readonly<GridStatePatch>): void— Atomically restores aversion: 1..5state snapshot or partial patch and emitsstateChanged.addEventListener<K extends GridEventType>(type: K, listener: GridEventListener<K>): void— Subscribes a typed listener to anyGridEventMapevent.removeEventListener<K extends GridEventType>(type: K, listener: GridEventListener<K>): void— Unsubscribes a previously registered listener.destroy(): void— Tears down DOM pools, observers, nested detail grids, modules, and listeners cleanly.