Skip to main content

afterSelect

Description

Fires after selecting an item

Usage

afterSelect: (
id: string | number,
subId?: string | number | undefined
) => void;

Parameters

The callback of the event takes the following parameters:

  • id - (required) the item id
  • subId - (optional) the id of a subheader of a swimlane or a text element of a line

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("AfterSelect", function(id) {
console.log(diagram.data.getItem(id).text + " was selected");
});

Change log: The subId parameter has been added in v4.1

Related articles:

Related sample: Diagram. Org chart mode. Events