Skip to main content

error

pro version only

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

triggered when an error occurs

note

The event is triggered when an error occurs, such as the module is disabled, the history is empty, the action type is invalid, or the inverse action is missing for the undo operation.

Usage

type ActionType = "add" | "remove" | "removeAll" | "change";

interface IAction {
type: ActionType;
batch: IRow[];
inverse?: IAction;
}

error: (error: string, action: IAction | null) => void;

Parameters:

The callback of the event is called with the following parameters:

error(string) the error message
action(object) the action object associated with the error, or null. It contains the following properties:
  • type - (string) the type of action: "add", "remove", "removeAll", or "change"
  • batch - (array) an array of rows representing the data affected by the action (e.g., added, removed, or modified rows)
  • inverse - (object) optional, the inverse action required for undoing (for the "change" and "removeAll" types)

Example

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
});

grid.history.events.on("error", (error, action) => {
console.log("Error:", error, action);
});

Related article: Work with History module

Change log:

added in v9.2