Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Remove node from group via context menu button

$
0
0

@agillespie wrote:

I suspect this is easy, but I’m new to the platform and I’ve already wasted a couple hours on topics very tangential to this experimenting, looking through samples, and the forum.

I’m customizing the basic example to make moving nodes into & out of groups easier. I have successfully implemented a “Add Node in Group” function with the following code:

makeButton("Add Nodein Group",
      function(e, obj) {  // OBJ is this Button
          var contextmenu = obj.part;  // the Button is in the context menu Adornment
          var part = contextmenu.adornedPart;  
          myDiagram.startTransaction('context menu click');
          myDiagram.model.addNodeData({"text":"default text","group":part.key});
          myDiagram.commitTransaction('context menu click');
        }),

My difficulty has been trying to do the reverse.

makeButton("Remove Node from Group",
      function(e, obj) {  // OBJ is this Button
          var contextmenu = obj.part;  // the Button is in the context menu Adornment
          var part = contextmenu.adornedPart;  
          myDiagram.startTransaction('context menu click');
          //some code to remove the "group" data from this node
          myDiagram.commitTransaction('context menu click');
        }),

I’ve not yet run into how to simply remove a data property.

Help is appreciated. Noob question, hopefully an easy answer.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles