Events
Subscribe to typed grid events via addEventListener / removeEventListener or pass on* callbacks in GridOptions<T>:
const onSort = (event) => { console.log(event.source, event.sort, event.transactionVersion);};
grid.addEventListener('sortChanged', onSort);// Later:grid.removeEventListener('sortChanged', onSort);Common Event Metadata (GridEventBase)
Section titled “Common Event Metadata (GridEventBase)”Every event in GridEventMap extends GridEventBase:
| Field | Type | Description |
|---|---|---|
source |
'api' | 'ui' | 'stateRestore' | 'datasource' |
Origin of the change |
state |
Readonly<GridState> |
Immutable v5 state snapshot after the commit |
transactionVersion |
number |
Monotonic committed transaction counter |
modelVersion |
number |
Monotonic row/data model version |
layoutVersion |
number |
Monotonic column/geometry layout version |
focusVersion |
number |
Monotonic focus state version |
selectionVersion |
number |
Monotonic selection state version |
GridEventMap (All 21 Events)
Section titled “GridEventMap (All 21 Events)”| Event Name | GridOptions Prop |
When Fired | Key Payload Fields |
|---|---|---|---|
stateChanged |
onStateChanged |
Any state-mutating commit finishes | previousState: Readonly<GridState> |
columnStateChanged |
onColumnStateChanged |
Column width, visibility, order, pin, flex, or setColumnDefs commits |
columns: Readonly<ColumnState>, previousColumns: Readonly<ColumnState> |
sortChanged |
onSortChanged |
Sort model changes | sort: SortModel |
filterChanged |
onFilterChanged |
Column filter model or quick filter changes | filters: FilterModel, quickFilter: string |
paginationChanged |
onPaginationChanged |
Pagination enabled state, page index, or page size changes | pagination: Readonly<PaginationState> |
modelUpdated |
onModelUpdated |
Displayed or total row counts change | rowCount: number, totalRowCount: number |
focusChanged |
onFocusChanged |
Logical focus moves or clears | focus: Readonly<FocusPosition>, previousFocus: Readonly<FocusPosition> |
selectionChanged |
onSelectionChanged |
Row or cell range selection changes | selection: Readonly<SelectionState | SelectionStateV3>, previousSelection |
rowDataChanged |
— | Row transaction commits (applyRowTransaction / async batch) |
transaction: Readonly<RowTransactionResult> |
cellValuesChanged |
— | Client cell mutations commit (edit, paste, cut, delete, fill, undo/redo, API) | origin: ValueChangeOrigin, changes: readonly CellValueChangeRecord[] |
cellEditRequest |
— | Edit/mutation occurs on a lazy rowSource or remote model |
requestId: number, dataEpoch: string, origin: ValueChangeOrigin, changes |
editSessionChanged |
— | Edit session starts, commits, cancels, validates, or aborts | session: Readonly<EditSession> | null, previousSession, reason: EditSessionChangeReason |
historyChanged |
— | Undo/redo stack records, undoes, redoes, clears, or prunes | history: Readonly<HistoryState>, reason: 'record' | 'undo' | 'redo' | 'clear' | 'dataChange' | 'limit' |
hierarchyChanged |
onHierarchyChanged |
Grouping, tree config, or branch expansion changes | hierarchy: Readonly<HierarchyState>, previousHierarchy: Readonly<HierarchyState> |
pivotChanged |
onPivotChanged |
Pivot mode, measures, or pivot expansion changes | pivot: Readonly<PivotState>, previousPivot: Readonly<PivotState> |
detailChanged |
— | Detail row expands or collapses | detail: Readonly<DetailState>, previousDetail: Readonly<DetailState> |
pinnedRowsChanged |
onPinnedRowsChanged |
Supplied pinnedRows or pinnedTotals change |
pinnedRows: Readonly<PinnedRowsMetadata>, previousPinnedRows |
cellSpansChanged |
onCellSpansChanged |
Active or suppressed cellSpans update |
cellSpans: Readonly<CellSpanState>, previousCellSpans |
datasourceChanged |
onDatasourceChanged |
Remote block cache or viewport connection state updates | data: Readonly<DatasourceState> |
processingChanged |
onProcessingChanged |
Reserved for future asynchronous processing; not emitted by the current synchronous pipeline | isProcessing: boolean |
error |
onError |
Contained cell callback, menu, clipboard, export, or datasource failure | message: string, operation?: GridErrorOperation, colId?: string, sourceIndices?: readonly number[] |
See Diagnostics & Error Handling for the full list of GridErrorOperation values and error containment rules.