Collapsed groups, when re-loaded, are expanded

I have a diagram with a group that has a few member parts. When I collapse the group with the sub graph expander button, save the diagram and re-load it with the saved data later (includes the two-way bound location data), the group is expanded again. Because the other node’s locations were saved based on the group’s collapsed location, the nodes overlap. Because of other computations we are performing, we need to set isInitial and isOngoing to false. Is there a way to either load the diagram with knowledge of whether or not the sub graph was last saved in the collapsed state or layout the diagram at the same time the node and link data arrays are being added? I have tried laying out the diagram after I add the node and link data and it does solve the problem, however there is couple second delay between the nodes/links appearing in the mis-aligned state and the re-layout of the diagram. I’m wondering if there is a way to re-layout the diagram/set the correct location for group nodes before the node data is added to the model so the user never sees the mis-aligned version of the diagram.

The “SubGraphExpanderButton” calls commands which set the value of Group.isSubGraphExpanded. Do you have a TwoWay Binding on that property?

Yes, I do.

That should mean that whether each group is expanded or collapsed is written out in the model data. Check the saved data in memory just before you load to make sure that the information is there and has the correct values.

How would I get access to the model data? I’m checking on the initial save to see what data I have available. On diagram.model I see nodeDataArray among other properties but I don’t see isSubGraphExpanded on any of the nodes in that array. What part of the model is that data attached to?

Look at the definition of the Binding of “isSubGraphExpanded” in the Group template. That will tell you what the property name is on the node data object in the model.