Skip to main content

enable()

pro version only

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

enables the module, allowing the addition of new actions to the Grid history

enable(): void;

Example

// The example shows how the module is enabled after deactivation on initialization
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 },
],
// disabled on initialization
history: { disabled: true }
});

// checking the state
console.log(grid.history.isDisabled()); // -> true

// enabling the module
grid.history.enable();
console.log(grid.history.isDisabled()); // -> false

// adding an action
grid.history.add({
type: "change",
batch: [{ id: "1", name: "Updated Item", value: 15 }],
inverse: { type: "change", batch: [{ id: "1", name: "Item 1", value: 10 }] },
});
console.log(grid.history.getHistory().length); // -> 1

Change log:

added in v9.2