I am trying to use groups in a GraphsLinksModel with a TreeLayout. Everything works fine when I expand/collapse nodes without any groups present in the diagram:
However, as soon as I associate the same nodes with a group that has layout = null, as instructed in the SubGraphs page, the layout is broken when toggling the nodes:
You need to set the Group.layout property in the group template to either null or (more commonly) an instance of a layout – in your case a TreeLayout. The choice depends on the kind of results you want.
as I already mentioned, I tried setting the layout to null and to the layout used by the diagram. None of these changed anything about the behaviour which seems to be a tree layout with an angle of 270:
The TreeLayout instance is initially created with the diagram and I set this layout instance to the group template when the template is created. Here’s the initial tree layout options:
angle: number = 90;
layerSpacing: number = 100;
nodeSpacing: number = 50;
alternateAngle: number = 90;
alternateLayerSpacing: number = 100;
alternateNodeSpacing: number = 150;
These do not at all match the result. It seems that the layout property in the group template is either ignored or replaced by some default value.
I’d like to be able to bind the layout in the template as a user can change the layout type at runtime. But I’d be happy if it worked as expected for now…
In v2.2.12, just released, we have added a check in the Group.layout property setter to notice if the new value is the same as Diagram.layout. If it is, it now throws an exception.