How to show only one subtree?

I am also looking for a filtering options in Dom Tree. For example my first node is a country node and based on country ,regions are fetched and similarly based on regions cities are fetched. So i want to put a region filter (it is a drodown), on selecting a specific region ,it should only show the node and its respective childnodes for that particular region only.

Although this isn’t precisely what you are asking for, I think this sample is very related: Local View It is different from your stated requirements in that it shows the tree both up the parent chain for two layers and the children down two layers.

So here’s what I would do:

  function showSubTree(node) {
    myDiagram.startTransaction();
    if (node instanceof go.Node) {
      // make all nodes, even root nodes, invisible
      myDiagram.nodes.each(function(n) { n.visible = false; });
      // but make the given node visible and show all of its children
      node.visible = true;
      node.findTreeParts().each(function(n) { n.visible = true; });
      // optional: expand the node and all its children
      node.expandTree(9999);
    } else {  // no Node given
      // just make all nodes visible
      myDiagram.nodes.each(function(n) { n.visible = true; });
    }
    myDiagram.commitTransaction("changed subtree");
  }