Collaps or Expand TreeExpanderButton

Hello

How can i collaps or expand TreeExpanderButton GoJS SubTrees -- Northwoods Software
in javascripte code ?

Thanks
Thanks
Thanks
Thanks
Thanks

Set (or bind) Node.isTreeExpanded. Or call Node.collapseTree or Node.expandTree.

1 Like

Hello
Thank but my problem is:
I use the example of Double Tree Double Tree.
when I add the TreeExpanderButton button,
I lose the double tree → Double Tree

I just copied the DoubleTree.html sample and added:

      , $("TreeExpanderButton")

to the node template.

Although the nodes don’t look great, they operate well when I click on the "TreeExpanderButton"s.

Yes
TreeExpanderButtons Works
but i lost double tree layout
how to keep double tree layout ?

What do you mean? By default collapsing a subtree will remember the locations of the hidden nodes, and then expanding that subtree will restore those node locations.

If you want to do another layout, just call doubleTreeLayout.

Oh, maybe you are asking about how to call doubleTreeLayout whenever the user collapses or expands a subtree? Implement “TreeCollapsed” and/or “TreeExpanded” DiagramEvent listeners.
https://gojs.net/latest/intro/events.html

I hope you now see why it is that we have a minimum length for a new post – we want to encourage you to include enough information so that we can understand what the environment is for your question.