If we change the layout properties isInitial & isOngoing to true, we get this result:
That is how we want it to look (properly aligned). But the problem here is the group’s nodes keep on changing its position as we scroll through the diagram. i.e. the auto layout process happens every time we scroll. We want to perform auto layout only once when the diagram loads initially. Is there any way to achieve it?
Have you virtualized your layout, so that the full model data includes all of the node locations in the data, including the groups?
Does your virtualization code (i.e. “ViewportBoundsChanged” listener) make sure to load all of the member nodes of each group whose bounds intersects with the viewport? If it loads member nodes incrementally as the user scrolls, that means nodes are incrementally being added to the group. Normally that invalidates the Group.layout, although setting Layout.isOngoing to false will prevent that invalidation.
If so, I believe you don’t need to enable the Group.layout, neither Layout.isInitial nor Layout.isOngoing.
That’s very odd. How is your code different from what is used in the Virtualized sample? Virtualized Sample with no Layout This has a lot of nodes and links but no layouts at all. Yes, it’s probably good to set Group.layout to null. You should not need to set Diagram.layout either, assuming all nodes have their desired locations in the model data.
I found the issue. It was due to incorrect location values generated through a temporary diagram. We have used a temporary diagram for auto layouting the whole model and used the location values provided by the model. The temporary diagram was missing diagram.div property when the diagram.layoutDiagram(true) was called which resulted in incorrect location values for nodes.