Search in organization chart


I need to allow user to search all nodes in organization chart, based on text. Textbox to search outside chart control. Root node should be visible all time while only child nodes with entered text should be displayed and remaining nodes should be hidden.


You’ll have to construct such a thing programatically, while looping through all nodes.

It is easy to iterate through all nodes:

for (var it = diagram.nodes;; ) {
    var n = it.value;  // n is now a Node or a Group
    if (n.category === "Special") { . . . }

You must then find the relevant TextBlock you’re looking for and test its text. Then set the .visible property of the node to true or false depending on your criteria.

The easiest way to find a TextBlock in a Node is to give it a name.

name: “TextBlockName”,

var textblock = node.findObject(“TextBlockName”); // returns null if there is no GraphObject element named TextBlockName