Documentation

@kanunilabs/datagrid-react-enterprise


@kanunilabs/datagrid-react-enterprise / UseGridEditingOptions

Interface: UseGridEditingOptions<TRow>

Type Parameters

TRow

TRow = GridRowData

Properties

allowAdding?

optional allowAdding?: boolean


allowDeleting?

optional allowDeleting?: boolean | ((row) => boolean)


allowUpdating?

optional allowUpdating?: boolean | ((row, columnId) => boolean)


appendOnArrowDown?

optional appendOnArrowDown?: boolean

Arrow-down on the LAST row appends a blank one. Default false.

The other half of the same data-entry habit: fill a row, press down, keep typing. Also off by default — with it on, a user who holds arrow-down to reach the bottom creates a row when they arrive.


confirmDelete?

optional confirmDelete?: boolean | ((rowKey, row) => boolean | Promise<boolean>)

Ask before deleting. Default: a browser confirm.

false deletes straight away. A FUNCTION replaces the prompt with the app's own dialog — return false (or a promise of false) to abandon it.


confirmDeleteMessage?

optional confirmDeleteMessage?: string

Wording for the built-in prompt. Ignored when confirmDelete is a function.


controller

controller: DataGridController<TRow> | null


crud?

optional crud?: CrudHandlers<TRow>

Per-row persistence — the app's own insert/update/delete calls.


editOnKeyPress?

optional editOnKeyPress?: boolean

Typing a printable key on a focused cell starts editing. Default true.


enabled?

optional enabled?: boolean

Disables editing entirely (unlicensed, or editing={false}).


focusCellOnCycle?

optional focusCellOnCycle?: boolean

Tab past the end of a row wraps to the next one. Default true.


focusCellOnTab?

optional focusCellOnTab?: boolean

Tab moves between cells inside the grid instead of leaving it. Default true.


insertKey?

optional insertKey?: boolean

Insert opens a blank row ABOVE the focused one. Default false.

Off by default because Insert is not a neutral key: some users have it bound elsewhere, and a grid that starts creating records on a keypress nobody asked for is a surprise. DevExpress spells this the same way.


keepEditingOnTab?

optional keepEditingOnTab?: boolean

Keep the editor open when Tab moves. Default false.


mode?

optional mode?: EditMode


newRowPosition?

optional newRowPosition?: NewRowPosition

Where addRow() puts the new record. Default 'last'.


onInitNewRow?

optional onInitNewRow?: (values) => void

Parameters

values

Record<string, unknown>

Returns

void


onRowInserted?

optional onRowInserted?: (key, row) => void

Parameters

key

RowKey

row

TRow | undefined

Returns

void


onRowRemoved?

optional onRowRemoved?: (key, row) => void

Parameters

key

RowKey

row

TRow | undefined

Returns

void


onRowUpdated?

optional onRowUpdated?: (key, row, values) => void

Parameters

key

RowKey

row

TRow | undefined

values

Record<string, unknown>

Returns

void


onSave?

optional onSave?: (changes) => void | Promise<void>

Parameters

changes

unknown[]

Returns

void | Promise<void>


rules?

optional rules?: Record<string, ValidationRule<TRow>[]>