TreeExpanderButton on LayeredDigraphLayout

Hi,

I wonder if the TreeExpanderButton can be used on a DigraphLayout. I tried it with TreeLayout and it worked with no problem as expected. Is it can be used with DigraphLayout?

Thanks.

Which Layout you are using doesn’t matter. The graph structure does matter. It might not do what you want if the graph is not a tree – i.e. nodes with multiple parents or cycles.

Another possibility is demonstrated by the sample https://gojs.net/latest/samples/customExpandCollapse.html. You will note that the sample does not use the “TreeExpanderButton” but a generic “Button”. It does not use the Node.isTreeExpanded property either, but it does use new properties defined on the model’s node data objects.

Yet other possibilities are plausible too. You can adapt that code to implement the behavior that you want.