Tree Order after Expand/Callapse

Hi, I have a diagram with 3 trees in it, all the trees have callapse/expand buuton next to nodes, but when hitting expand or collapse button the tree is moved to the first position at the diagram. So is there a solution to make the tree remain in it current position after expand/collapse.

The Trees are LayeredDiagraphLayout.

LayeredDigraphLayout is intended not to maintain any ordering of nodes in any layer.

If your graphs are trees, I recommend that you use TreeLayout.

The graph is Tree but with child to parent liniking, and the TreeLayout seems to break the layout even if the isTreePathToChildren is set to false

Sample graph/tree data


var nodeArray = [];
nodeArray.push({ key: “Iren”, fill: go.Brush.randomColor(), text : “Iren” });
nodeArray.push({ key: “Katy”, fill: go.Brush.randomColor(), text : “Katy” });
nodeArray.push({ key: “Human”, fill: go.Brush.randomColor(), text : “Human”});
nodeArray.push({ key: “Male”, fill: go.Brush.randomColor(), text : “Male” });
nodeArray.push({ key: “Female”, fill: go.Brush.randomColor(), text : “Female” });
nodeArray.push({ key: “Joe”, fill: go.Brush.randomColor(), text : “Joe” });
nodeArray.push({ key: “Bruce”, fill: go.Brush.randomColor(), text : “Bruce” });
nodeArray.push({ key: “John”, fill: go.Brush.randomColor(), text : “John” });

var linkArray = [
{ from: “Male”, to: “Human” },
{ from: “Female”, to: “Human” },
{ from: “Joe”, to: “Male” },
{ from: “Bruce”, to: “Male” },
{ from: “John”, to: “Male” },
{ from: “Katy”, to: “Female” },
{ from: “Iren”, to: “Female” }
];


Maybe you also need to set go.TreeLayout.path = go.TreeLayout.PathSource?

Thanks, that fix the issue.

And one more question, is it possible to have multiple trees one after another from left to right instead of heaving them one above other (top to bottom).

Set TreeLayout.arrangement.