Skip to main content

getItem()

Description

Returns the object of an item by its id

Usage

getItem(id: string | number): object;

Parameters

  • id - (required) the id of a selected item

Returns

The method returns the object of an item

Example

const diagram = new dhx.Diagram("diagram_container", {
type: "default"
});
diagram.data.parse(data);

const shape = diagram.data.getItem(123);

You can access the original properties of an item like this:

// accessing the properties of the shape
const shape = diagram.data.getItem(123);
const text = shape.text;

Related articles: Getting an item