When node is moved how to find the origin group


when a node is moved from groupA to groupB how to find the groupA name (diagram.selection keeps info about groupB only)

thanks in advance

In samples such as Regrouping, http://gojs.net/latest/samples/regrouping.html, note how the Group.mouseDrop event handler calls Group.addMembers. That is what makes sure the Part.containingGroup property is set to that group.

Before that call selected nodes will still be in their original group. But if the node started in the same group, of course the containingGroup property does not change.

The question is how to pick up groupA name before the node is moved(mousedrag event?). I implemented mouseDrop but cannot access this information.

this is my function member validation. The log bellow shows not only the origin group but also the current one (where the node was dropped). I don’t understand why the function is called twice .

// decide what kinds of Parts can be added to a Group
myDiagram.commandHandler.memberValidation = function(grp, node) {
//cannot drop group onto the group
if (grp instanceof go.Group && node instanceof go.Group) {
return false; // cannot add Groups to Groups
//cannot drop nodes onto the orphans group unless it was orphans in sudoc
//(functional requirement to not delete a link by moving a node to orphans group)
if(grp instanceof go.Group && grp.data.key === 2 && node instanceof go.Node && node.data.originalLink !== 2){
return false;
// but dropping a Group onto the background is always OK
if(node instanceof go.Node)
return true;