Documentation

@kanunilabs/datagrid-react-enterprise


@kanunilabs/datagrid-react-enterprise / UseGridEditingResult

Interface: UseGridEditingResult<TRow>

Type Parameters

TRow

TRow = GridRowData

Properties

addRow

addRow: (values?, beforeKey?) => RowKey | null

Adds a pending row and opens its first editable cell. Null when not allowed.

beforeKey puts it directly above that row instead of at the end — what the Insert key needs.

Parameters

values?

Record<string, unknown>

beforeKey?

RowKey

Returns

RowKey | null


beginEdit

beginEdit: (rowKey, columnId) => void

Parameters

rowKey

RowKey

columnId

string

Returns

void


beginRowEdit

beginRowEdit: (rowKey) => boolean

Open a whole ROW (row / form / popup modes). False when the mode does not support it, or another row is already open — the caller decides what to do with the first one rather than having it saved or discarded silently.

Parameters

rowKey

RowKey

Returns

boolean


cancelChanges

cancelChanges: () => void

Returns

void


cancelRowEdit

cancelRowEdit: () => void

Discard the open row's edits. Other rows keep theirs.

Returns

void


clearSaveError

clearSaveError: () => void

Dismiss the save error once the user has read it.

Returns

void


copySelection

copySelection: () => boolean

Copy the selected RANGE. False when no range is selected, which lets the Community row copy take the gesture instead.

Returns

boolean


cut

cut: (target?) => boolean

Copy the selected RANGE, then clear the cells the user may clear. One undo step. False when there was nothing to cut.

Cells the permissions refuse are copied but left in place: the user asked for the part they own, and refusing the whole rectangle over one read-only column would be the less useful answer.

Parameters

target?

{ columnId: string; rowKey: RowKey; } | null

Returns

boolean


deleteRow

deleteRow: (rowKey) => boolean

Parameters

rowKey

RowKey

Returns

boolean


editAdjacentCell

editAdjacentCell: (direction, options?) => boolean

Commit and move to the next (1) or previous (-1) editable cell. By default the destination is only FOCUSED; pass open: true to carry the editor along, cycle: false to stop at the end of a row instead of wrapping.

Parameters

direction

-1 | 1

options?
cycle?

boolean

open?

boolean

Returns

boolean


editFocusedCellWith

editFocusedCellWith: (char) => boolean

Open the editor on the focused cell, seeded with a typed character.

Parameters

char

string

Returns

boolean


endFillDrag

endFillDrag: () => void

Returns

void


engine

engine: EditingEngine<TRow> | null


fillPreview

fillPreview: CellRange | null


focusScroller

focusScroller: () => void

Return DOM focus to the grid's scroller. Closing an editor destroys the element that held focus, so every path that ends a session has to call this or the keyboard goes dead until the user clicks the grid again.

Returns

void


handleKeyDown

handleKeyDown: (event) => boolean

Parameters

event

KeyboardEvent

Returns

boolean


isDraggingFill

isDraggingFill: boolean


moveFillDrag

moveFillDrag: (row, column) => void

Parameters

row

number

column

number

Returns

void


paste

paste: () => Promise<void>

Paste the clipboard over the range, anchored at its top-left cell.

Returns

Promise<void>


pendingDelete

pendingDelete: PendingDelete | null

A delete waiting on confirmation, or null.


range

range: RangeApi


resolveDelete

resolveDelete: (confirmed) => void

Answer the confirmation: true deletes, false abandons.

Parameters

confirmed

boolean

Returns

void


rowSaveError

rowSaveError: string | null

Message from the last rejected row save; null once anything changes.


saveChanges

saveChanges: () => Promise<void>

Returns

Promise<void>


saveError

saveError: BatchSaveError | null

Why the last save was refused, or null.


saveRowEdit

saveRowEdit: () => Promise<boolean>

Validate and persist the open row. Resolves false and stays open on failure.

Returns

Promise<boolean>


selectionStats

selectionStats: SelectionStats | null

Totals for the current range, or null when nothing is selected.


startFillDrag

startFillDrag: (row, column) => void

Parameters

row

number

column

number

Returns

void


version

version: number

Bumped on every engine change; consumers read through it.