Skip to main content


fires on selecting an item, but before the item is really selected

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


  • 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


const diagram = new dhx.Diagram("diagram_container", { 
type: "org",
select: true
});"BeforeSelect", function(id) {
console.log("Selecting " +;
return true;

Related sample: Diagram. Org chart mode. Events

Returning false from the handler will block the selection.

Change log:

SubId parameter has been added in v4.1.