How to use allowGroup and allowUngroup diagram properties?

Hi,
apparently, these two properties are just flags (along with Group.ungroupable Part.groupable) and have no effect on user’ ability to group and/or ungroup nodes using dragging toll (looks similar to Model.isReadOnly).
I tested it on your “regrouping.html” sample.
To change this I probably need to modify dragging tool, but “beforeDropping” which does not exists. Can you please clarify how to prevent particular user from grouping/ungrouping parts?

Thank you

Setting Diagram.allowGroup to false disallows the grouping keyboard shortcut CTRL+G from grouping a selection, which you can see in this sample.

user’ ability to group and/or ungroup nodes using dragging toll

The Dragging Tool does not typically group or unground nodes. Or do you mean the DragSelectingTool? All it does it draw a selection box around nodes.

Do you need the ability to make nodes unselectable? There’s Diagram.allowSelect for that.

Simon

What I mean is user’ ability to select a node and drag it into a group’ placeholder, or do opposite - drag a node out of a group and place it somewhere else.

At the same time, I do not want to prevent user from using dragging tool for repositioning nodes or groups

That is non-standard behavior, and the only reason it happens in regrouping.html is because of this code:

    myDiagram.groupTemplateMap.add("OfGroups",
      $(go.Group, "Auto",
        {
          ...
          // when the selection is dropped into a Group, add the selected Parts into that Group;
          // if it fails, cancel the tool, rolling back any changes
          mouseDrop: finishDrop,
          ...


    // Upon a drop onto a Group, we try to add the selection as members of the Group.
    // Upon a drop onto the background, or onto a top-level Node, make selection top-level.
    // If this is OK, we're done; otherwise we cancel the operation to rollback everything.
    function finishDrop(e, grp) {
      var ok = (grp !== null
                ? grp.addMembers(grp.diagram.selection, true)
                : e.diagram.commandHandler.addTopLevelParts(e.diagram.selection, true));
      if (!ok) e.diagram.currentTool.doCancel();
    }

Simply remove that code if you don’t want that functionality.