Position Issue while expanding and ungrouping group

An issue arises when multiple groups are created. When expanding and ungrouping, the location of the Groupnextnode collapses to the position of the Subprocess.

function ShiftAllNodesAfterGroup(Subprocess, GroupPreviousNode, Groupnextnode, Direction) {
AllNodesArrayAfterSubprocess = [];
var SubprocessNodesCount = Subprocess.findSubGraphParts();
var it = SubprocessNodesCount.iterator;
var SubprocessNodesCountarr = [];
var SubprocessNodesCountarr_2 = [];
while (it.next()) {
var GroupNodeData = it.value.data;
var GroupNodeData2 = it.value;
if (GroupNodeData.hasOwnProperty(‘nodeName’)) {
SubprocessNodesCountarr.push(GroupNodeData);
}
SubprocessNodesCountarr_2.push(GroupNodeData2);
}

        var NodeToShift = (SubprocessNodesCountarr.length - 1) * 150;
        var AllNodesAfterSubprocess = findAllNodesAfterSubprocess(Subprocess);
        BPMNDiagram.startTransaction("NodeMove");
        if (Direction == "LeftToRight") {
            for (var i = 0; i < AllNodesAfterSubprocess.length; i++) {
                var loc = go.Spot.parse(AllNodesAfterSubprocess[i].data.loc);
                var nodeLoc = new go.Point(loc.x - NodeToShift, loc.y);
                AllNodesAfterSubprocess[i].move(nodeLoc);
            }
        }
        else if (Direction == "RightToLeft") {
            for (var i = 0; i < AllNodesAfterSubprocess.length; i++) {
                var loc = go.Spot.parse(AllNodesAfterSubprocess[i].data.loc);
                var nodeLoc = new go.Point(loc.x + NodeToShift, loc.y);
                AllNodesAfterSubprocess[i].move(nodeLoc);
            }
        }
        else {
            for (var i = 0; i < AllNodesAfterSubprocess.length; i++) {
                var loc = go.Spot.parse(AllNodesAfterSubprocess[i].data.loc);
                var nodeLoc = new go.Point(loc.x, loc.y);
                AllNodesAfterSubprocess[i].move(nodeLoc);
            }
        }
        BPMNDiagram.commitTransaction("NodeMove");
        if (GroupPreviousNode != null && Subprocess.data.group != GroupPreviousNode.data.group) {
            if (Groupnextnode != null) {
                var GroupNextNodeLOC = go.Spot.parse(Groupnextnode.data.loc);
                BPMNDiagram.startTransaction("SubprocessMove");
                var nodeLoc = new go.Point(GroupNextNodeLOC.x - 150, GroupNextNodeLOC.y);
                Subprocess.move(nodeLoc);
                BPMNDiagram.commitTransaction("SubprocessMove");
            }                
        }
    }

I cannot tell what situation you have, what the behavior is, and what behavior you want instead. What is your screenshot showing? In general you should show both before and after screenshots along with the actions that you performed to change state, plus a screenshot or sketch and description of what’s wrong and what you want instead.

In this way, we can make a group of nodes.
For example, I took two nodes for the group.


The plus sign is used to expand the group.
This shows us the nodes involved in making the group.

I followed the same steps above: I added two nodes, selected them, and then made them into a group.


I expanded the group in this image, but the location of the second group did not change and it appears collapsed.

Did you want the unexpanded group to move towards the right? That’s usually the responsibility of the layout, to automatically position all nodes (and maybe route all links) in whatever manner the layout desires. Perhaps you want to use ParallelLayout: Parallel Layout

If you don’t want to employ automatic layout because you want your users to manually control the position of each node, then you need to define exactly the conditions in which you want to move nodes even though the user may have moved them before. You’d be overriding their instructions. What are the conditions and actions that you want to implement?