Skip to content

Row edit panel ​

Since 1.6.0

The rowEditPanel option and openRowPanel, closeRowPanel, getRowPanelState and saveRowPanel are available from 1.6.0. They need the editing bundle.

Rows with many columns are awkward to edit cell by cell. With rowEditPanel on, one row opens in a form docked beside the grid. Each field uses the column's editor (text, number, select, date, checkbox, multi-line …), so the same input rules apply as when you edit the cell directly.

ts
createGrid(container, {
  columns, // columns with editable: true become fields of the form
  rows,
  rowKey: 'id',
  rowEditPanel: true, // double-click a row to open the form
});

Try it in the gallery example Edit a row in a side form.

Options ​

rowEditPanel is false (default), true (all defaults) or an object.

KeyDefaultMeaning
position'end'Where the panel sits. 'end' is the right side in LTR and the left in RTL, 'start' is the opposite. 'bottom' is below the grid
size360Width in px (height for 'bottom'). At least 200
fieldsevery editable columnColumn ids to show, in order. A column that cannot be edited is shown as read-only text
open'dblclick'How the panel opens. 'dblclick': double-click a data row (instead of editing the cell). 'select': select one row. 'api': only openRowPanel
modalfalsetrue floats over the grid instead of pushing it. In a container narrower than 640px it always opens as a bottom sheet
rowTitlevalue of the first text column(row) => string. The title in the panel header

A bad value is rejected with invalid-option before anything changes. setOptions can turn it on and off; turning it off closes an open panel.

The form and saving ​

  • Every field has a label. Fields with validation.required carry a * (screen readers say "Required").
  • A cell that cannot be edited on this row (an editable function returning false) is shown as read-only text.
  • Changing a value shows an Unsaved changes marker in the header.
  • Save (Ctrl+Enter or the button) applies only the changed fields at once. Validation, beforeEdit, the editCommitted event and change tracking run per cell exactly as for a direct edit, and undo is one step.
  • If any rule fails nothing is saved. Each failing field shows why and focus goes to the first one. The same validationFailed event as a cell edit is raised.
  • After saving the panel closes and focus returns to the grid cell. With nothing changed it just closes.

Opening and closing ​

To doHow
OpenDouble-click a row (open: 'dblclick'), select a row (open: 'select'), api.openRowPanel(rowKey)
Move to another rowThe Previous row and Next row buttons, or open another row
SaveThe Save button, Ctrl(⌘)+Enter, api.saveRowPanel()
CloseThe Cancel or × button, Esc, a click on the backdrop, api.closeRowPanel()

Opening another row or closing with unsaved values first asks the beforeRowPanelClose hook. Without the hook, or if it returns anything but false, the edited values are discarded. closeRowPanel({ discard: true }) discards without asking.

ts
hooks: {
  beforeRowPanelClose: ({ rowKey }) =>
    confirm(`Discard the unsaved values of row ${rowKey}?`), // false keeps the panel open
}

API ​

MethodDescription
openRowPanel(rowKey)Opens the panel. Returns false if a hook blocks it. Throws for an unknown row, and with invalid-option if rowEditPanel is off
closeRowPanel(opts?)Closes the panel. { discard: true } drops edited values without asking. Returns false if it is not open or a hook blocks it
getRowPanelState(){ open, rowKey, dirty, invalid }. invalid lists the column ids that currently fail validation
saveRowPanel()Saves the changed fields at once. Returns false if validation fails or a hook blocks it

Events and hooks ​

NameKindContent
rowPanelOpenedevent{ rowKey }
rowPanelClosedevent{ rowKey, reason }. reason is 'save', 'cancel', 'api' or 'switch'
rowPanelSavedevent{ rowKey, changes }. changes has { from, to } per column id
beforeRowPanelOpenhook{ rowKey, previousKey }. false keeps it closed
beforeRowPanelSavehook{ rowKey, changes }. Called after validation, just before saving. false skips the save
beforeRowPanelClosehook{ rowKey, dirty, reason }. Called only with unsaved values. false keeps the panel open

Keyboard ​

KeyAction
Tab / Shift+TabCycle inside the panel only
EnterGo to the next field (not in a multi-line field or on a button)
Ctrl(⌘)+EnterSave (also from inside a multi-line field)
EscCloses an open list or calendar first, otherwise cancels

Position and narrow screens ​

  • 'end' and 'start' shrink the grid by the panel width; 'bottom' makes the grid as much lower. The outer size of the grid does not change when the panel opens or closes.
  • modal: true floats over the grid without pushing it (role="dialog", a click on the backdrop cancels).
  • A container narrower than 640px always opens a bottom sheet (dialog), whatever modal says.
  • With direction: 'rtl', 'end' and 'start' swap. Dark theme, forced colors and the languages (ko, en, ja, zh) are followed.

Accessibility ​

The panel is a named complementary region (a dialog when it overlays). Opening moves focus to the first field and closing returns it to the grid cell. Opening, saving and validation failures are announced to screen readers.

Good to know ​

  • While the panel is open, changes made to the same row elsewhere are not re-read into the form. Saving overwrites only the fields you changed in the form.
  • There are no slots yet to customise a field (such as rowPanelField). In React, Vue and Angular just pass the option through.
  • The older form panel example (master-form) shows how to build one by hand with a detail panel. From 1.6.0 this option is simpler.

See also ​