Skip to main content



Finds the item that corresponds to the specified parameters


find(rule: object): object;

// or

find(rule: function): object;


  • rule - (required) the search criteria which can be specified:
    • as an object which contains the following parameters:
      • by: string | function - the search criterion (either the key of the item attribute or a search function)
      • match: string - the value of the item attribute
    • as a function: DataCallback(item: T, index?: number, array?: T[])


The method returns the first object of the item that matches the specified criteria


const diagram = new dhx.Diagram("diagram_container", {
type: "default"

//searching for a shape by the attribute key
const shape ={ by: "text", match: "Manager" });

//searching for a shape by the rule specified in the function
const shape ={
if(shape.text==="Manager"||shape.text==="Marketer"){return true}

Related articles: Finding the necessary item

Related sample: Diagram. Data. Finding necessary shape