Skip to main content

removeAll()

pro version only

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

clears the entire Grid history and the redo stack

note

If the module is disabled, the operation is ignored, and the error event is triggered.

removeAll(): void;

Example

// The example shows clearing the history after adding multiple rows
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 two actions
grid.history.add({
type: "add",
batch: [{ id: "2", name: "New Item 1", value: 20 }],
});
grid.history.add({
type: "add",
batch: [{ id: "3", name: "New Item 2", value: 30 }],
});

// clearing the history
grid.history.removeAll();
console.log(grid.history.getHistory().length); // -> 0
console.log(grid.history.canRedo()); // -> false

Change log:

added in v9.2