beforeUnSelect
Description
Fires on unselecting an item, but before the item is really unselected
Usage
"beforeUnSelect": ({
id: string | number,
batch: (string | number)[]
}) => void | boolean;
Parameters
The callback of the event is called with an object with the following parameters:
id
- the id of an item to unselectbatch
- the list of items to unselect
Returns
Return false
to prevent an item from being unselected; otherwise, true
Example
// initializing Diagram
const diagram = new dhx.Diagram("diagram_container", {
type: "org",
select: true
});
// loading data
diagram.data.parse(data);
// attaching a handler to the event
diagram.events.on("beforeUnSelect", ({ id }) => {
console.log(id + " will be unselected");
return true;
});
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("beforeUnSelect", ({ id }) => {
console.log(id + " will be unselected");
return true;
});
Change log: Updated in v6.0
Related articles: