Undo / Redo Edits
This section covers how to allow users to undo / redo their cell edits.
When Cell Editing is enabled in the grid, it is usually desirable to allow users to undo / redo any edits.
Users can change the contents of cells through the following grid features:
Enabling Undo / Redo
The following undo / redo properties are provided in the grid options interface:
As shown in the snippet above, undo / redo is enabled through the
The default number of undo / redo steps is
10. To change this default the
undoRedoCellEditingLimit property can be used.
Undo / Redo Shortcuts
The following keyboard shortcuts are available when undo / redo is enabled:
- Ctrl+Z / CMD+Z: will undo the last cell edit(s).
- Ctrl+Y / CMD+SHIFT+Z: will redo the last undo.
Note that the grid needs focus for these shortcuts to have an effect.
Undo / Redo API
It is also possible to control undo / redo using the following grid API methods:
Example: Undo / Redo
The example below has the following grid options enabled to demonstrate undo / redo:
To see undo / redo in action, try the following:
- Cell Editing: click and edit some cell values.
- Fill Handle: drag the fill handle to change a range of cells.
- Copy / Paste: use CTRL+C / CTRL+V to copy and paste a range of cells.
- Undo Shortcut: use CTRL+Z to undo the cell edits.
- Redo Shortcut: use CTRL+Y to redo the undone cell edits.
- Undo API: use the 'Undo' button to invoke
- Redo API: use the 'Redo' button to invoke