Regrouping issue

my Source is :

myDiagram.groupTemplate =
    GO(go.Group, "Auto",
        {
            defaultAlignment: go.Spot.TopLeft,
            opacity: 0.8,
            ungroupable: true,
            selectionObjectName: "PH",
            locationObjectName: "PH",
            resizable: true,
            resizeObjectName: "PH",
            mouseDragEnter: function (e, grp, prev) {
                if (grp.isSubGraphExpanded) {
                    highlightGroup(e, grp, true);
                }
            },
            mouseDragLeave: function (e, grp, next) {
                if (grp.isSubGraphExpanded) {
                    highlightGroup(e, grp, false);
                }
            },
            computesBoundsAfterDrag: true,
            computesBoundsIncludingLocation: true,
            subGraphExpandedChanged: function (group) {
                var body = group.findObject("PH");
                if (group.isSubGraphExpanded) {
                    group.mouseDrop = finishDrop;
                    for (var i=0; i < oriSize.length; i++) {
                        if (oriSize<em>.id ===  group.__gohashid) {
                            body.desiredSize =  oriSize<em>.size;
                            delete oriSize<em>;
                            oriSize.splice(i,1);
                            break;
                        }
                    }
                    group.resizable = true;
                    body.strokeWidth = 2;
                } else {
                    group.mouseDrop = function empty(){};
                    oriSize.push({id:group.__gohashid,size:body.desiredSize});
                    body.desiredSize = new go.Size(120, 40);
                    group.resizable = false;
                    body.strokeWidth = 5;
                }
            },
            mouseDrop: finishDrop
        },
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        GO (go.Panel, go.Panel.Auto,
            GO(go.Shape, "RoundedRectangle",
                {
                    name: "PH",
                    isPanelMain: true
                },
                new go.Binding("fill", "background")
            )
        ),
        GO(go.Placeholder,
            { name: "groupHolder", padding: new go.Margin(35,10,10,10) }
        ),
        GO(go.Panel, go.Panel.Vertical,
            { alignment: go.Spot.TopLeft, margin: new go.Margin(5,10,5,10) },
            GO(go.Panel, go.Panel.Horizontal,
                { stretch: go.GraphObject.Horizontal },
                GO("SubGraphExpanderButton",
                    { alignment: go.Spot.Right },
                    GO(go.Picture,
                        { desiredSize: new go.Size(12, 12) }
                    )
                ),
                GO(go.TextBlock,
                    { alignment: go.Spot.Left, editable: true,
                        name: "TEXT",
                        font: "Bold 12pt Sans-Serif",
                        wrap: go.TextBlock.None,
                        margin: new go.Margin(2,0,0,0),
                        maxSize: new go.Size(100, NaN),
                        isMultiline: false, text: "Group"
                    },
                    new go.Binding("text", "text").makeTwoWay())
            )
        )
    );

If you are in a group and the group of the following symptoms occur

help

GO (go.Panel, go.Panel.Auto,
GO(go.Shape, "RoundedRectangle",
{
name: "PH",
isPanelMain: true
},
new go.Binding("fill", "background")
)
),
This section was added to the problem "group autosize"

Thank you for the Group definition and the screenshots, but what is the problem? Under what circumstances do the desired behaviors happen, and under what circumstances do the undesired behaviors happen?

Can you simplify the template(s) and still get the problem?

I still have a problem.
ungrouping is not working in such a case link exist in the group.

The ungroup command works well in the Basic sample: http://gojs.net/latest/samples/basic.html

Could you describe more precisely and in more detail how to reproduce your situation?

you are right. ungroup command works very well
but

GO (go.Panel, go.Panel.Auto,
GO(go.Shape, "RoundedRectangle",
{
name: "PH",
isPanelMain: true
},
new go.Binding("fill", "background")
)
),
when this code use included GO (go.Panel, go.Panel.Auto,
ungroup is not worked
use my code plz

I am unable to try any code at the moment.
But it is very odd to have an Auto Panel that only includes a single element, a Shape.

Also, the Picture object does not show anything.

The Vertical Panel will be centered in the Placeholder. And that Vertical Panel has only one element in it.

I solved the other way

I remove Auto.Panel and add the code below

code:

myDiagram.addDiagramListener(“ChangedSelection”, function(e){
var sel = e.diagram.selection;
var selData = sel.toArray();
window.node = selData[0];
});

myDiagram.addDiagramListener(“PartResized”, function(e) {
resizeGroup(window.node,e);
});

function resizeGroup(own,e) {
if (!own.data.isGroup) return;

var size;
var allNodes = e.diagram.nodes;

setTimeout(function() {
    myDiagram.startTransaction("BoundarySetup");
    size = own.findObject("groupHolder").measuredBounds.size;
    own.findObject("PH").minSize = size;
    myDiagram.commitTransaction("BoundarySetup");
},10)

allNodes.each(function(node) {
    if (node.data.key === own.data.group) {
        resizeGroup(node,e);
    }
});

}