Skip to main content

beforeUnSelect

fires on unselecting an item, but before the item is really unselected

beforeUnSelect: (id: Id, subId?: Id | undefined) => void | boolean;

Parameters:

  • id: string | number - the item id
  • subId: string | number | undefined - optional, the id of a subheader of a swimlane or a text element of a line

Example

const diagram = new dhx.Diagram("diagram_container", { 
type: "org",
select: true
});

diagram.events.on("BeforeUnSelect", function(id) {
console.log("Unselecting " + diagram.data.getItem(id).text);
return true;
});

Related sample: Diagram. Org chart mode. Events

Returning false from the event handler will block unselection.

Change log:

SubId parameter has been added in v4.1.