Skip to content

Undo & Redo

Enable history on client-side grids to support Ctrl/Cmd+Z (undo) and Ctrl/Cmd+Y / Ctrl/Cmd+Shift+Z (redo) across single-cell edits and multi-cell clipboard or fill batches.

const grid = new Grid<Order>({
container,
columnDefs,
rowData,
getRowId: (row) => row.id,
history: {
maxEntries: 100,
maxRows: 10_000,
maxCells: 50_000,
},
});
if (grid.canUndo()) grid.undo();
if (grid.canRedo()) grid.redo();
const stats = grid.getHistoryState(); // { enabled, undoCount, redoCount, retainedRows, retainedCells, version }
grid.clearHistory();
  • Batched Operations: Multi-cell paste, cut, delete, and drag-fill record as a single history entry (historyChanged fires with reason: 'record' | 'undo' | 'redo' | 'clear' | 'dataChange' | 'limit').
  • What Clears History: Calling setRowData, setRowSource, refreshRows, or setColumnDefs with value-function changes clears the undo/redo stack (reason: 'dataChange').
  • Client-Only Constraint: history cannot be enabled on remote models ('infinite', 'serverSide', 'viewport').