Skip to content

Listening to Events

Subscribe to any of the 21 events in GridEventMap via grid.addEventListener(type, listener) or pass on* callbacks in GridOptions<T>.

Some mutation and layout events (rowDataChanged, cellValuesChanged, cellEditRequest, editSessionChanged, historyChanged, detailChanged) do not have on* constructor options in GridOptions<T> and are subscribed via addEventListener (or framework adapter outputs like @cell-values-changed / (cellValuesChanged)):

const onSort = (event: GridEventMap['sortChanged']) => {
if (event.source === 'api') return; // prevent feedback loops
syncBackendSort(event.sort);
};
grid.addEventListener('sortChanged', onSort);
grid.removeEventListener('sortChanged', onSort);
  • source ('api' | 'ui' | 'stateRestore' | 'datasource'): Identifies what triggered the commit so listeners can distinguish user interaction ('ui') from programmatic restoration ('stateRestore', 'api').
  • Version Counters: Every GridEventBase carries transactionVersion, modelVersion, layoutVersion, focusVersion, and selectionVersion.
  • Single-Transaction Ordering: Domain-specific events (sortChanged, filterChanged, columnStateChanged, selectionChanged, focusChanged, modelUpdated) fire after atomic model commit, followed by a single stateChanged summary event per committed transaction.