canRedo()
pro version only
This functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) package.
checks whether an action within the Grid history can be redone
canRedo(): boolean;
Returns:
Returns true
if the redo stack contains actions and the module is not disabled.
Example
// The example shows checking whether redo is possible after undoing
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
});
// modifying data
const updatedItem = { id: "1", name: "Updated Item", value: 15 };
grid.data.update("1", updatedItem);
grid.history.add({
type: "change",
batch: [{ ...updatedItem }],
inverse: { type: "change", batch: [{ id: "1", name: "Item 1", value: 10 }] },
});
// undoing and checking
grid.history.undo();
if (grid.history.canRedo()) {
console.log("Redo is possible");
grid.history.redo();
}
Related article: Applying undo/redo operations to Grid history actions
Related API: redo()
Change log:
added in v9.2