AddNodeData and move node/group


i add data with the function “addNodeData” to my model.
How can I move a node after it has been drawn. It its a group with a placeholder, so the members set the location of the group. But i want move the group to another position. Can i move the group in an event?

Thx for help!!

The basic answer to your first question is something like:

  var data = { . .. };  // with whatever properties your node's model data needs
  var node = myDiagram.findNodeForData(data);
  node.move(new go.Point(12, 34));

Note that you only need to move a new Node explicitly if the Diagram.layout doesn’t move the node automatically.

An alternative way to get that effect is to have a data Binding of Node.location or Node.position in the node template, in which case you can set the location or position in the node data object, and you don’t have to find and move the Node at all.

Yes, you can move a Group by calling Group.move. It’s a bit inconvenient in that move takes a Point that is the new position, not the new location.