remove()
pro version only
This functionality requires PRO version of the DHTMLX Grid (or DHTMLX Suite) package.
removes the last action from the Grid history
note
If the history is empty or the module is disabled, the operation is ignored, and the error
event is triggered (for a disabled module).
remove(): void;
Example
// The example shows removing the last action from the history after modifying a value
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 a value via DataCollection
const updatedItem = { id: "1", name: "Updated Item", value: 15 };
grid.data.update("1", updatedItem);
// adding the action to history
grid.history.add({
type: "change",
batch: [{ ...updatedItem }],
inverse: { type: "change", batch: [{ id: "1", name: "Item 1", value: 10 }] },
});
// removing the last action
grid.history.remove();
console.log(grid.history.getHistory().length); // -> 0
Related article: Adding/removing Grid history actions
Related API: add()
, removeAll()
, getHistory()
Change log:
added in v9.2