isSubGraphExpanded doesn't preserved on copy/paste group

Hi

We have a problem that after copy/paste groups collapse/expand state is not copied. Can be reproducible on Grouping sample. I tried to implement it by overriding pasteFromClipboard() method but it is not possible to find a match between copied and pasted artifacts. Do you have any suggestions?

Thanks, Anton.

When you say that the state is not copied, is the state kept on the node data object? In other words, do you have a binding such as:

    new go.Binding("isSubGraphExpanded").makeTwoWay()

on your Group template?

Yes, we do have two way binding to data object. isSubGraphExpanded state saving/loading together with the model.

I just tried modifying the Group template in samples/basic.html by adding the following two Lines:

        new go.Binding("isSubGraphExpanded").makeTwoWay(),
        $("SubGraphExpanderButton"),

I found that copying an expanded group produced an expanded group, and copying a collapsed group produced a collapsed group.

Thanks Walter for your help. I also just verified on Grouping sample. It works.

Well, as I found out, it only works in the Grouping sample if you disable the automatic creation of member nodes and links (the subgraph) upon expand if there are zero members.

To get that to work, I added a property on the group data (which I called “everExpanded”), that controls whether or not it adds the member nodes and links upon expansion. When it does, it sets the flag to true, preventing a copy from adding members before its gets its expected copy of the original group’s subgraph.