Ultimately, this code doesn’t seem to change the number of links allowed; the number of links remains at the amount that was originally specified in the Node template.
Is this the proper way to do this? Or am I missing something?
I suspect that what you are missing is that you are setting that property on the whole Node, not on the port as is needed. This is mentioned in the documentation: GraphObject | GoJS API
If your node template is only using a single port, you could do:
var node = goDiagram.findNodeForKey(updatedNode.key);
if (node !== null) {
goDiagram.startTransaction();
node.port.fromMaxLinks = updatedNode.numOfPaths;
goDiagram.commitTransaction("changed fromMaxLinks");
}
But if your node(s) have more than one port, you’ll need to find it or them either with Node.findPort or by iterating over Node.ports.