find

finds the shape that corresponds to the specified parameters

object find(string|function by,string match);

Parameters

bystring|functionthe search criterion (either the key of the shape attribute or a filtering function)
matchstringthe value of the shape attribute

Returns

objectthe object of the matching shape

Example

//searching for a shape by the attribute key
var shape = diagram.data.find({by:"text",match:"Manager"});
 
//searching for a shape by the function
var shape = diagram.data.find(function(shape){
    if(shape.text==="Manager"||shape.text==="Marketer"){return true}
});

Related samples

See also
Back to top