change
Description
Fires on changes in the dataset of the diagram
Usage
change: (
id?: string,
status?: "add" | "update" | "delete" | "load"
updatedItem?: object
) => void;
Parameters
The callback of the event takes the following parameters:
id
- (optional) the id of the changed itemstatus
- (optional) the status of the change: "add", "update", "delete", "load"updatedItem
- (optional) the object of the changed item
info
There are cases when the handler function doesn't take any parameters, e.g. while a data set is parsed into the diagram where all shapes are removed
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("change", function (id, status, shape) {
console.log("The " + id + " has been " + status);
});