React Data Grid Events

Events

React Data Grid callback props — onXxx handlers, each receiving structured state as plain arguments.

Every state change calls the matching onXxx prop with structured state as plain arguments:

<CDataGrid
  columns={columns}
  items={items}
  onSortingChange={(sorting) => console.log(sorting)}
/>
PropPayload
onSortingChangesorting: SortingState
onFilterChangecolumnFilters: ColumnFiltersState, globalFilter: string
onSelectionChangerowSelection: RowSelectionState, selectedItems: object[]
onPaginationChangepagination: PaginationState
onEditStartitem: object, columnId: string
onEditCommit{ item, columnId, value, previousValue } — the grid never mutates items; apply the change yourself. Undo/redo re-calls it with the values swapped
onEditCancelitem: object, columnId: string
onSizingChangecolumnSizing: ColumnSizingState
onPinningChangecolumnPinning: ColumnPinningState
onOrderChangecolumnOrder: ColumnOrderState
onVisibilityChangecolumnVisibility: VisibilityState
onDataLoad{ items, totalRows } (server-side mode)
onDataErrorerror: unknown (server-side mode)

The state types (SortingState, ColumnFiltersState, …) are exported from @coreui/react-data-grid. Callbacks fire for changes driven through the headless table too.