Table events and payloads
Reference for table change notifications and DOM input events. onChangeSelection/onChangeSort/onChangeSortModel/onChangeColumnLayout report internal state changes; there are no matching controlled input props. onChangeData requests a parent data update.
Table props
Section titled “Table props”onChangeData
Section titled “onChangeData”onChangeData?: (data: TData[]) => void;Entire next row array produced by edits/moves. Apply it to parent data. Sorting alone does not reorder the source data.
onChangeSelection
Section titled “onChangeSelection”onChangeSelection?: (selection: CominsSelectionState) => void;Since 0.2.2, external data changes clearing Flat/Tree selection also notify this callback.
Notification of a changed row-ID/cell/range selection snapshot. Not a data update callback.
onChangeSort
Section titled “onChangeSort”onChangeSort?: (sort: CominsSortState | null) => void;Notification of the primary single sort or null. Use onChangeSortModel for all rules.
onChangeSortModel
Section titled “onChangeSortModel”onChangeSortModel?: (sortModel: CominsSortModel) => void;Notification of the full ordered sort model. Does not automatically request server-side sorting.
onChangeColumnLayout
Section titled “onChangeColumnLayout”onChangeColumnLayout?: (layout: CominsColumnLayout) => void;Layout-change notification for movement, size, and visibility state. Save and restore using ref.setColumnLayout.
onClickCell
Section titled “onClickCell”onClickCell?: (payload: CominsCellEventPayload<TData>) => void;Receives raw value and row/column on a cell click, after built-in selection handling. The event may bubble to the row.
onClickRow
Section titled “onClickRow”onClickRow?: (payload: CominsRowEventPayload<TData>) => void;Row click event; may also run when a cell click bubbles.
onDoubleClickCell
Section titled “onDoubleClickCell”onDoubleClickCell?: (payload: CominsCellEventPayload<TData>) => void;Cell double-click event carrying raw value; not an edit commit callback.
onDoubleClickRow
Section titled “onDoubleClickRow”onDoubleClickRow?: (payload: CominsRowEventPayload<TData>) => void;Row double-click event.
onContextMenuCell
Section titled “onContextMenuCell”onContextMenuCell?: (payload: CominsCellEventPayload<TData>) => void;Cell context-menu event. Call event.preventDefault() to suppress the browser menu.
onContextMenuRow
Section titled “onContextMenuRow”onContextMenuRow?: (payload: CominsRowEventPayload<TData>) => void;Row context-menu event. Account for cell-event bubbling and row selection.
onKeyDownCell
Section titled “onKeyDownCell”onKeyDownCell?: (payload: CominsCellKeyboardEventPayload<TData>) => void;React cell keyboard event with row, column, value, and key information.
onKeyDownRow
Section titled “onKeyDownRow”onKeyDownRow?: (payload: CominsRowKeyboardEventPayload<TData>) => void;React row keyboard event; cell keyboard events may bubble.
onBeforeRowDrag
Section titled “onBeforeRowDrag”onBeforeRowDrag?: (payload: CominsBeforeRowDragPayload<TData>) => boolean | void;Return false to veto a drag before it starts. Async Promise returns are not supported.
onRowDrag
Section titled “onRowDrag”onRowDrag?: (payload: CominsRowDragPayload<TData>) => void;Reports a native PointerEvent and current target during dragging. Check target.valid; this event alone does not commit a data move.
onAfterDragRow
Section titled “onAfterDragRow”onAfterDragRow?: (payload: CominsAfterDragRowPayload<TData>) => void;Reports result, reason, and optional target at the end. event can be null. Check for moved before treating it as success.
CominsTreeTableProps
Section titled “CominsTreeTableProps”onChangeData
Section titled “onChangeData”onChangeData?: (data: CominsTreeNode<TData>[]) => void;In Tree mode, receives the entire next CominsTreeNode array. Apply expansion and move results to the parent.
onBeforeRowDrag
Section titled “onBeforeRowDrag”onBeforeRowDrag?: (payload: CominsBeforeTreeRowDragPayload<TData>) => boolean | void;Tree starts from pointer or keyboard events; return false to veto.
onRowDrag
Section titled “onRowDrag”onRowDrag?: (payload: CominsTreeRowDragPayload<TData>) => void;Receives native pointer/keyboard events and the tree destination.
onAfterDragRow
Section titled “onAfterDragRow”onAfterDragRow?: (payload: CominsAfterTreeRowDragPayload<TData>) => void;Tree completion result; event may be PointerEvent, KeyboardEvent, or null.
CominsViewportTableProps
Section titled “CominsViewportTableProps”onChangeData
Section titled “onChangeData”onChangeData?: (data: CominsViewportData<TData>) => void;Viewport receives a CominsViewportData snapshot, not a plain row array.
CominsEventRow
Section titled “CominsEventRow”export type CominsEventRow<TData> = { data: TData; dataIndex: number; id: CominsRowId; index: number;};data is the source row; id is the business ID. index is the display index and dataIndex is the source-array index. Viewport uses absolute indexes.
CominsEventColumn
Section titled “CominsEventColumn”export type CominsEventColumn<TData, TValue = unknown> = { definition: CominsTableRuntimeColumn<TData, TValue>; field: string; id: string; index: number; label: React.ReactNode;};definition is the normalized column definition; index is the visible column index.
CominsRowEventPayload
Section titled “CominsRowEventPayload”export type CominsRowEventPayload<TData, TEvent = React.MouseEvent<HTMLTableRowElement>> = { event: TEvent; index: number; row: CominsEventRow<TData>;};Top-level index and row.index identify the event row display position.
CominsCellEventPayload
Section titled “CominsCellEventPayload”export type CominsCellEventPayload<TData, TValue = unknown, TEvent = React.MouseEvent<HTMLTableCellElement>> = { column: CominsEventColumn<TData, TValue>; event: TEvent; index: number; row: CominsEventRow<TData>; value: TValue;};value is the raw cell value, not renderer output.
CominsRowKeyboardEventPayload
Section titled “CominsRowKeyboardEventPayload”export type CominsRowKeyboardEventPayload<TData> = CominsRowEventPayload<TData, React.KeyboardEvent<HTMLTableRowElement>>;Specializes the row payload event to React.KeyboardEvent.
CominsCellKeyboardEventPayload
Section titled “CominsCellKeyboardEventPayload”export type CominsCellKeyboardEventPayload<TData, TValue = unknown> = CominsCellEventPayload<TData, TValue, React.KeyboardEvent<HTMLTableCellElement>>;Specializes the cell payload event to React.KeyboardEvent.
CominsBeforeRowDragPayload
Section titled “CominsBeforeRowDragPayload”export type CominsBeforeRowDragPayload<TData> = { event: React.PointerEvent<HTMLElement>; row: CominsEventRow<TData>; sourceGroupId?: CominsRowId; sourceTableId?: string;};Source row and optional group/table identifiers at drag start.
CominsRowDragPayload
Section titled “CominsRowDragPayload”export type CominsRowDragPayload<TData> = Omit<CominsBeforeRowDragPayload<TData>, "event"> & { event: PointerEvent; target: CominsRowDragTarget;};Replaces the start event with native PointerEvent and adds target.
CominsAfterDragRowPayload
Section titled “CominsAfterDragRowPayload”export type CominsAfterDragRowPayload<TData> = Omit<CominsBeforeRowDragPayload<TData>, "event"> & { event: PointerEvent | null; reason: CominsRowDragReason; result: CominsRowDragResult; target?: CominsRowDragTarget;};Completion includes cancellation and rejection as well as successful drops.
CominsRowDragTarget
Section titled “CominsRowDragTarget”export type CominsRowDragTarget = { tree?: CominsTreeMoveDestination & { position: CominsTreeDropPosition; }; dataIndex?: number; groupId?: CominsRowId; rowId?: CominsRowId; tableId?: string; valid: boolean;};valid may be false; rowId/groupId/tableId/tree depend on the target mode.
CominsRowDragResult
Section titled “CominsRowDragResult”export type CominsRowDragResult = "cancelled" | "moved" | "rejected";Only moved denotes a successful move.
CominsRowDragReason
Section titled “CominsRowDragReason”export type CominsRowDragReason = "blur" | "drop" | "duplicate-id" | "escape" | "invalid-target" | "pointer-cancel" | "stale-target" | "unchanged";Distinguishes termination reasons. Check result as well as drop.
CominsBeforeTreeRowDragPayload
Section titled “CominsBeforeTreeRowDragPayload”export type CominsBeforeTreeRowDragPayload<T> = { event: React.PointerEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>; row: CominsEventRow<T>;};Tree drag start also supports keyboard input.
CominsTreeRowDragPayload
Section titled “CominsTreeRowDragPayload”export type CominsTreeRowDragPayload<T> = { event: PointerEvent | KeyboardEvent; row: CominsEventRow<T>; target: CominsRowDragTarget;};Payload while dragging a tree row.
CominsAfterTreeRowDragPayload
Section titled “CominsAfterTreeRowDragPayload”export type CominsAfterTreeRowDragPayload<T> = { event: PointerEvent | KeyboardEvent | null; row: CominsEventRow<T>; target?: CominsRowDragTarget; reason: CominsRowDragReason; result: CominsRowDragResult;};Payload when a tree drag ends.