Collaps or Expand TreeExpanderButton


#1

Hello

How can i collaps or expand TreeExpanderButton https://gojs.net/latest/intro/subtrees.html
in javascripte code ?

Thanks
Thanks
Thanks
Thanks
Thanks


#2

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


#3

Hello
Thank but my problem is:
I use the example of Double Tree https://gojs.net/latest/samples/doubleTree.html.
when I add the TreeExpanderButton button,
I lose the double tree -> https://fevill.github.io/goJs--entity-relationship/TreeExpanderButton.html


#4

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.


#5

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


#6

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.