Editing
Overview
rs-grid supports inline cell editing. Double-click a cell (or press Enter on a selected cell) to start editing. The web layer overlays a DOM input element over the canvas cell.
Editing lifecycle
Start editing
The grid stores the current cell value in an EditCell snapshot so it can
be restored on cancel.
Commit
The new value is written to the data source (or the patches layer for read-only sources). The edit is recorded in the undo history.
Cancel
Restores the original value. No undo entry is created.
Cell editors
The editor type is controlled by ColumnDef::editor:
Text input (default)
When editor is None or Some(CellEditor::Text), a plain <input type="text">
is shown:
Select dropdown
For fixed-choice columns, use CellEditor::Select:
Each SelectOption has:
value— stored in the cell on commitlabel— displayed in the dropdownicon— optional icon URL shown left of the label
Undo support
Cell edits are automatically recorded in the undo history. Press Ctrl+Z to undo or Ctrl+Y to redo. See Undo & Redo for details.
Editing with read-only data sources
Even FnDataSource (which has no set_cell) supports editing — the new value
is stored in GridModel::patches, which overrides the data source for that cell.