So if I use a linking tool to draw a line between two nodes. How am I able to also get the two nodes and add a property?
The “LinkDrawn” DiagramEvent listener is passed one argument whose DiagramEvent.subject will be the newly drawn Link. GoJS Events -- Northwoods Software and DiagramEvent | GoJS API
The connected Nodes will be the Link.fromNode and the Link.toNode. If you want to change properties on their model data, just do something like:
$(go.Diagram, "myDiagramDiv",
{ . . .,
"LinkDrawn": function(e) {
var link = e.subject;
var from = link.fromNode;
var to = link.toNode;
e.diagram.model.setDataProperty(from.data, "someProperty", ...someValue...);
e.diagram.model.setDataProperty(to.data, "someProperty", ...someValue...);
},
. . .
})
Thanks. Works well.