afterSelect
Description
Fires after selecting an item
Usage
"afterSelect": ({
id: string | number,
join: boolean,
batch: (string | number)[]
}) => void;
Parameters
The callback of the event is called with an object with the following parameters:
id
- the id of the selected itemjoin
- the applied mode of selectionbatch
- the list of selected items
Example
// initializing Diagram
const diagram = new dhx.Diagram("diagram_container", {
select: true,
// other config options
});
// loading data
diagram.data.parse(data);
// attaching a handler to the event
diagram.events.on("afterSelect", ({ id }) => {
console.log(id + " was selected");
});
Here's an example of attaching an event handler to the event for the Diagram Editor:
// initializing Diagram editor
const editor = new dhx.DiagramEditor("editor_container", {
// config options
});
// loading data into the editor
editor.parse(data);
// attaching a handler to the event
editor.diagram.events.on("afterSelect", ({ id }) => {
console.log(id + " was selected");
});
Change log: Updated in v6.0
Related articles: