Hello,
I would like to call a function when a node is clicked and send the function called the key of the clicked node. I have the first part that calls the function. I can also receive something in the called function but I do not know how to get the key from the node object in the called function.
How do I get the key?
Here is the node information and the called function:
myDiagram.nodeTemplate =
graphObjectMake(go.Node, “Table”,
{
<span =“Apple-tab-span” style=“white-space:pre”> click: getNodeData
},
{ locationObjectName: “BODY”,
locationSpot: go.Spot.Center,
selectionObjectName: “BODY”,
selectionAdornmentTemplate:
graphObjectMake(go.Adornment, “Auto”,
graphObjectMake(go.Shape, “Rectangle”,
{ stroke: “dodgerblue”,
strokeWidth: 3,
fill: null }),
graphObjectMake(go.Placeholder)
)
},
{
mouseDragLeave: function (e, node, next) {
},
mouseDrop: function (e, node) {
}
},
new go.Binding("key", "text", go.Point.parse).makeTwoWay(go.Point.stringify),
// the body
graphObjectMake(go.Panel, "Auto",
{ row: 1, column: 1, name: "BODY",
stretch: go.GraphObject.Fill },
graphObjectMake(go.Shape, "RoundedRectangle",
{ fill: "blue",
minSize: new go.Size(135, 65) },
new go.Binding("fill", "color").makeTwoWay()),
graphObjectMake(go.Panel, "Table",
{maxSize: new go.Size(135, 65),
defaultAlignment: go.Spot.Center },
graphObjectMake(go.RowColumnDefinition, { column: 1, row: 3, width: 10 }),
graphObjectMake(go.TextBlock,"name",
{ margin: 5,
row: 1, column: 0,
editable: false,
stroke:"SlateGrey",
font: "11pt sans-serif",
textAlign: "center" },
new go.Binding("text", "name").makeTwoWay())
<span =“Apple-tab-span” style=“white-space:pre”> )
) // end Auto Panel body
); // end Node
function getNodeData(node)
{
<span =“Apple-tab-span” style=“white-space:pre”> //<span =“Apple-tab-span” style=“white-space:pre”> <How do I get the key of the node variable?>
var sd = “dsafhj”;
var hg = sd;
}