Change a group via mouse click and show result on screen

I put buttons on nodes to represent left and right movement. Intent is to move an entity from one group to another by clicking on the appropriate button. I can change the group membership internally but the entity does not physically reflect the change until a refresh is done. I cannot figure out how to show the entity moving without a refresh.

Any insight is appreciated.

Thanks much.

All changes to a model, its data, or to GraphObjects in a diagram should be wrapped in a transaction.

Note that commands usually perform transactions.

Thanks for the quick response Walter.

I had the important mods wrapped in a transaction, but the physical change (a jump to the target group) does not occur. What I think I am doing and what I am doing is wrong. So the below is what I had wrapped in a transaction:
if (node instanceof go.Node) {
var data =;
myObj =
var paddr = data.key;
var data =;
var paddr = data.key;
var ingrp =;
var col = data.incol + incr;

		if (col > 3 && col < 0) {

		ingrp = "grp" + col.toString() + ingrp.charAt(ingrp.length - 1);
		data.incol = col; = ingrp;
		data.lastmove = format_new_date();

		var grp_rec = myDiagram.model.findNodeDataForKey(ingrp);
		var old_rec = myDiagram.model.findNodeDataForKey(data.key);
		myDiagram.model.startTransaction("update node");;
		myDiagram.model.setDataProperty(old_rec, "group",;

		myDiagram.model.setGroupKeyForNodeData(old_rec, ingrp)

		myDiagram.model.setDataProperty(old_rec, "col", data.incol);
		myDiagram.model.setDataProperty(old_rec, "lastmove", data.lastmove);

		myDiagram.isModified = true;
		myDiagram.layout.invalidateLayout() ;

		myDiagram.model.commitTransaction("update node");

Thanks much.

You seem to be changing some data properties without calling Model.setDataProperty, e.g. data.incol = col; = ingrp; data.lastmove = ... (Calling setDataProperty isn’t needed if you don’t have any data bindings on the property and if you don’t care about undo/redo.)

Trying to call Model.setDataProperty on the same object with the same properties and same values will be a no-op. That would explain why nothing is updating.

It’s odd that you are setting the ‘containingGroup’ property on the model node data object. That probably has no effect.

It’s odd that you’re trying to set the group key on the same model data object (old_rec) three times in a row.

You don’t need to set Diagram.isModified to true – that will happen automatically.

You probably don’t need to call Layout.invalidateLayout either, although I don’t know what you’re trying to do, really.

Anyway, you can make your code a lot simpler, and I bet that will make it work too.

Thanks much Walter. I will takeon your recommendations.