Skip to main content

redo()

pro version only

This functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) package.

reapplies the last undone action in the Grid history

note

If the redo stack is empty or the module is disabled, the error event is triggered.

redo(): void;

Example

// The example shows redoing the undone row addition
const grid = new dhx.Grid("grid_container", {
columns: [
{ id: "name", header: [{ text: "Name" }] },
{ id: "value", header: [{ text: "Value" }] },
],
data: [
{ id: "1", name: "Item 1", value: 10 },
],
history: true
});

// adding a new row
const newItem = { id: "2", name: "New Item", value: 20 };
grid.data.add(newItem);
grid.history.add({
type: "add",
batch: [{ ...newItem }],
});

// undoing and redoing
grid.history.undo();
grid.history.redo();
console.log(grid.history.getHistory().length); // -> 1
console.log(grid.history.canUndo()); // -> true

Change log:

added in v9.2