Query on editable org chart

Have you seen the Org Chart sample, Org Chart Static ? It demonstrates searching the whole diagram.

To hide the rest of the diagram, which sounds as if it does not depend on the results of the search, I suggest you iterate over all of the Diagram.nodes and set each Node.visible if it is in the subtree of the selected node.

Something like:

    var selected = myDiagram.selection.first();
    if (selected == null) return;
    myDiagram.startTransaction();
    var subtree = selected.findTreeParts();
    myDiagram.nodes.each(function(n) {
        n.visible = subtree.contains(n);
      });
    myDiagram.commitTransaction("hid rest of tree outside of selected subtree");