Skip to main content

includes()

Description​

Checks whether an element is in the selection list

Usage​

includes({
id: string | number
}): boolean;

Parameters​

The method takes as an argument an object with the following parameters:

  • id - (required) the id of the checked item

Returns​

The method returns true if the element is in the selected list, otherwise false

Example​

// a diagram must be created with the "select:true" option
const diagram = new dhx.Diagram("diagram_container", {
select: true
});
// loading data
diagram.data.parse(data);

diagram.selection.getIds(); // -> ["1", "2", "3"]
diagram.selection.includes({ id: "1" }) // returns true
diagram.selection.includes({ id: "4" }) // returns false

Change log: Added in v6.0

Related articles:

Related sample: Diagram. Selection. Item selection