Skip to main content

afterAdd

Description

Fires after adding an item

Usage

afterAdd: (newItem: object) => void;

Parameters

The callback of the event takes the following parameter:

  • newItem - (required) the object of an added item

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("afterAdd", function(newItem){
console.log("A new item is added");
});

The event can be used to provide default values or a default formatting for the item's data