Documentation

@kanunilabs/datagrid-react-enterprise


@kanunilabs/datagrid-react-enterprise / EditingOptions

Interface: EditingOptions<TRow>

Type Parameters

TRow

TRow = GridRowData

Properties

allowAdding?

optional allowAdding?: boolean

Show the "New row" command and allow addRow(). Default false.


allowDeleting?

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

Deletable rows. A predicate decides per row. Default false.


allowUpdating?

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

Editable cells. A predicate decides per row and column. Default true.


appendOnArrowDown?

optional appendOnArrowDown?: boolean

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

The other half of the same habit — fill a row, press down, keep typing. Opt-in for the same reason: with it on, holding arrow-down to reach the bottom creates a row on arrival.


appendOnTab?

optional appendOnTab?: boolean

Tab on the last editable cell of the last row adds a blank row at the bottom and moves to its first editable cell (P-7.8). Default false; needs allowAdding. With it on, Shift+Tab on the grid's first cell stays there instead of leaving the grid; it never adds a row. Under commitOn: 'row' a row added this way and left blank is dropped, never sent.


batchBar?

optional batchBar?: boolean

Draw the grid's own Save / Cancel strip in mode: 'batch'. Default true.

false leaves it out of the DOM entirely — for an app with its own Save button (call api.saveChanges() / api.cancelChanges()). Pending edits, the changed-cell marks and rowStatus work the same either way.


commandColumn?

optional commandColumn?: boolean

Add a pinned column of icon actions at the end of the grid. Default false.

A common pattern in grid editing UIs: New row / Save / Discard live in its header, per-row Edit / Delete / Undo in its cells. Off by default because it costs a column of width, which a read-only grid has no use for.


commandLabels?

optional commandLabels?: Partial<CommandColumnLabels>

Wording for the command column's buttons (tooltips and screen readers).


commitOn?

optional commitOn?: CommitOn

When mode: 'cell' saves (P-10). Default 'cell': every committed cell is saved at once, as before.

'row': moving between the cells of one row saves nothing; the row goes as ONE save — one onSave call (or one crud.insert / crud.update) with all its values — when the user leaves it: to another row (arrow, Tab past the row's end, Enter, a click, Insert, arrow-down on the last row) or out of the grid. Until then the row reads changed (new for an added row) in rowStatus. api.saveChanges() sends it too.

A new row nothing was written into — the values onInitNewRow or addRow(values) seeded do not count — is dropped instead of sent: on leaving it, on Escape, on Save. A row whose save is refused (a rule checked on save, such as required on a column never opened, or the server) is not sent and reads error, with the reason under the row under rowStatus.messages; focus is not pulled back to it, and it is not sent again until it is edited again, retried, or saved with saveChanges(). Ignored by the other modes.


confirmDelete?

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

Ask before deleting a row. 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.


crud?

optional crud?: CrudHandlers<TRow>

Per-ROW persistence — one call per insert/update/delete, which is what a REST or SQL back end wants. Supplying any handler here takes precedence over onSave; a rejection fails the save and leaves the changes pending.


deleteKey?

optional deleteKey?: boolean

Ctrl+Delete (Cmd+Delete on a Mac) deletes the focused row (P-7.5). Default false. Order: allowDeleting for that row, then confirmDelete, which must be a FUNCTION here — without one nothing is deleted (the built-in prompt is not used for the key). On a row already marked removed (batch) Ctrl+Delete restores it. When the row leaves the grid (cell mode, an unsaved new row) focus moves to the row below it, else above. While an editor is open the key is the text box's (deletes the next word). When on, the key is always preventDefault()ed on a focused cell, even when nothing is deleted.


editKeys?

optional editKeys?: EditKeys

Which gestures open a cell's editor (P-7.1). Each field left out keeps today's behaviour: { f2: true, enter: false, typing: true, doubleClick: true }.

  • f2: false — the grid does not handle F2 at all and does not preventDefault() it; the key reaches the page (an app whose F2 is Save).
  • enter: true — Enter opens the focused editable cell's editor; Enter or Shift+Enter in an open editor commits and STAYS on the cell (instead of moving down). Enter never adds a row. On a cell that cannot be edited Enter is still onRowActivate.
  • typing: false — typing on a focused cell does not open its editor (same as editOnKeyPress: false; this one wins when both are given).
  • doubleClick: false — neither a double-click nor a double-tap opens an editor (onCellDoubleClick handlers of the app still run).

editOnKeyPress?

optional editOnKeyPress?: boolean

Typing a printable character on a focused cell opens the editor with that character, replacing the cell's value. Default true.


enabled?

optional enabled?: boolean

Editing UI on or off. Default TRUE — and the default applies with no editing prop at all: an EnterpriseDataGrid opens editors and offers Cut/Paste unless told otherwise (the vanilla twin documents the same default). A read-only Enterprise grid passes { enabled: false }, which also turns off range selection, the fill handle and paste.

Written down after field report KL-08 (2026-09-22): a grid rendered without editing was taken to be read-only, and its Cut/Paste menu entries to be a bug.


fillKeys?

optional fillKeys?: boolean

Ctrl+D (fill down) and Ctrl+R (fill right) over the selection. Default true. false leaves both keys to the page (Ctrl+R: reload) — the fill handle still works.


focusCellOnCycle?

optional focusCellOnCycle?: boolean

Tab past the last editable cell of a row wraps to the next row (and Shift+Tab to the previous). Default true. With it off, a run of Tabs simply stops at the end of the row.


focusCellOnTab?

optional focusCellOnTab?: boolean

Tab (and Shift+Tab) commits the cell and moves to the next editable one INSIDE the grid, instead of letting the browser tab out of it. Default true.


formHeight?

optional formHeight?: number

Starting height in px for the in-grid form (mode: 'form'), before it has been measured. Only worth setting to stop the one-frame resize on open — the real height is measured from the rendered form either way.


formLabels?

optional formLabels?: Partial<EditFormLabels>

Wording for the form/popup editor (mode: 'form' | 'popup') — the buttons, the title and the shortcut hint. User-facing text, so it is translatable.


history?

optional history?: boolean

Undo / redo: Ctrl+Z, Ctrl+Y (Ctrl+Shift+Z) and controller.undo() / redo(), and api.undo() / redo(). Default true. false keeps no reachable history: the keys are left to the page and the methods answer false. A successful save takes what it sent out of the history — in batch everything up to that save, in cell the saved change (no reverse save is ever sent).


insertKey?

optional insertKey?: boolean | "above" | "below"

Insert opens a blank row next to the focused one and opens its first editable cell: true or 'above' directly ABOVE it, 'below' under it. Default false (off). Needs allowAdding.

A data-entry habit. Opt-in: Insert is a key users may have bound elsewhere, and a grid that starts creating records unasked is a surprise. Ignored while an editor is open, where Insert belongs to the text field. When on, Insert on a focused cell is always preventDefault()ed, even when no row can be added, so a page-level Insert shortcut does not fire for it (P-7.5).


keepEditingOnTab?

optional keepEditingOnTab?: boolean

Carry the EDITOR along when Tab moves. Default false: the destination cell is focused but not opened, which is the spreadsheet convention — you tab across a row to read it, and start typing only where you mean to.


mode?

optional mode?: EditMode


newRowPosition?

optional newRowPosition?: NewRowPosition

Where addRow() puts the new record: 'last' (default) or 'first'. With a sort active the sort still decides the final position.


onInitNewRow?

optional onInitNewRow?: (values) => void

Seed a row created by addRow(). With a FUNCTION rowKey this is also where the key has to be set — the grid cannot invent one it cannot read.

Parameters

values

Record<string, unknown>

Returns

void


onReady?

optional onReady?: (api) => void

Called ONCE when the grid's editing is ready (P-1), with the EditingApi: hasChanges, getChanges, saveChanges, cancelChanges, addRow, removeRow, restoreRow, isRemoved, getRowStatus, getRowStatusError, getErrorRowKeys, effectiveRow, undo / redo, isDirty, revertRow, revertCell. It is the same object controller.editing returns while the grid is mounted, the same on every render, and it survives a React StrictMode remount (no second call). After the grid unmounts its methods do nothing and do not throw. Default: not called.

Parameters

api

EditingApi<TRow>

Returns

void


onRowInserted?

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

Fired after each row-level operation is persisted.

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>

Persist a batch of changes. Rejecting keeps them pending.

Parameters

changes

RowChange<TRow>[]

Returns

void | Promise<void>


range?

optional range?: boolean

Enables range selection, the fill handle and paste. Default true. With enabled: false, range: true keeps cell and range selection and Ctrl+C (what the cells show) on a grid nobody can edit.


rangePaste?

optional rangePaste?: boolean

Ctrl+V spreads a copied table over the selected cells. Default true. false: the paste goes to the focused cell only, and the clipboard text is ONE value — tabs and line breaks do not split it over cells. Copy, cut, selection and the fill handle are unchanged.


rules?

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

Validation rules per column id.