Skip to main content

beforeRemove

Description

Fires after removing an item from a data collection

Usage

beforeRemove: (removedItem: any) => boolean | void;

Parameters

The callback of the event takes the following parameter:

  • removedItem - (required) the object of an item to remove

Returns

Return false to block removing an item from a data collection; otherwise, true.

Example

// initializing Diagram
const diagram = new dhx.Diagram("diagram_container", {
type: "default"
});
// loading data
diagram.data.parse(data);

// attaching a handler to the event
diagram.events.on("beforeRemove", (newItem) => {
console.log("beforeRemove "+ item);
return true;
});