Skip to main content

Events

The grid is uncontrolled by default — it manages its own state and tells you about changes through onXChange callbacks. Listen to sync a URL, persist to your backend, fire analytics, or lift a slice of state into a controlled prop.

<DataTable
columns={columns}
data={rows}
enableSorting
onSortingChange={(sorting) => console.log('sort →', sorting)}
/>

State-change events

EventSignatureFires when
onSortingChange(sorting: SortingState) => voidThe sort model changes.
onGlobalFilterChange(value: string) => voidThe quick-filter term changes.
onColumnFilterChange(state, isApplied?) => voidA column filter rule changes (isApplied = committed vs. draft).
onPaginationChange(pagination: PaginationState) => voidPage index or page size changes.
onSelectionChange(selection: SelectionState) => voidRow selection changes (include / exclude sets).
onColumnVisibilityChange(visibility: Record<string, boolean>) => voidA column is shown / hidden.
onColumnOrderChange(order: string[]) => voidColumns are reordered.
onColumnPinningChange(pinning: ColumnPinningState) => voidA column is pinned / unpinned.
onColumnSizingChange(sizing: Record<string, number>) => voidA column is resized.
onRowPinningChange(pinning: RowPinningState) => voidA row is pinned top / bottom.
onListViewChange(listView: boolean) => voidThe grid ⇄ list toggle flips.

Interaction events

EventSignatureFires when
onRowClick(event, row) => voidA row is clicked (selectOnRowClick also toggles selection).
onClipboardCopy(rowCount: number) => voidSelected rows are copied (Cells).

Editing events

EventSignatureFires when
processRowUpdate(newRow, oldRow) => T | Promise<T>An edit commits — return the row to persist, or throw to reject.
onProcessRowUpdateError(error) => voidprocessRowUpdate throws / rejects (the edit reverts).
onRowEditStart({ row }) => voidA row enters edit mode (editMode: 'row').
onRowEditStop({ row, reason }) => voidA row leaves edit mode (reason: 'save' | 'cancel').

Data / server events

Used in server mode:

EventSignatureFires when
onFetchData(filters, meta?) => Promise<{ data, total }>The grid needs a page (sort / filter / page changed).
onRefreshData(context) => void | Promise<void>The toolbar Refresh button is pressed.
onDataStateChange(state: Partial<TableState>) => voidAny data-affecting state changes (one aggregate hook).
onFetchStateChange(filters, options?) => voidThe fetch parameters change (before the fetch).

Export events

See Export for the full lifecycle:

onExportProgress · onExportComplete · onExportError · onExportStateChange — plus the server-side handlers onServerExport / onExportStream / onExportPoll / onExportCancel.

Seed, observe, control

Most state (sorting, filters, pagination, selection, column layout) is seed-and-observe: give it a starting value with initialState and watch changes with the onXChange callback — the grid owns the live value.

<DataTable
columns={columns}
data={rows}
initialState={{ sorting: [{ id: 'name', desc: false }] }} // seed
onSortingChange={(s) => syncUrl(s)} // observe
/>

A few features are fully controlled — pass the value prop and its callback to own them outright: density, listView, and saved views / activeViewId. In server mode you control the data itself by returning it from onFetchData.

See State for the full model.