filters item in the diagram by the specified key

void filter(object|function criteria, [boolean mode] );


criteriaobject|functionthe filtering criteria (either the key of the item attribute or a filtering function)
modebooleanoptional, true to define that each next filtering will be applied to the already filtered data, not to the initial data


// filtering by the key of the shape attribute{by:"text",match:"Manager"});
// filtering by a function{
    if(shape.text==="Manager"||shape.text==="Marketer"){return true}

Related samples


The criteria parameter set as object has the following attributes:

  • by - (string) the key of the item attribute
  • match - (string) the value of the item attribute

The method will render only the items that meet the filtering criteria. To revert the diagram to the initial state, call the filter() method without parameters.;
See also
Back to top