Below is my code…
I have two buttons name “edit” and “del”.
I want to find the key value on button click event .
How can i do that .
Thanks.
var $1 = go.GraphObject.make; // for conciseness in defining templates
myDiagram = $1(go.Diagram, "myDiagramDiv", // create a Diagram for the DIV HTML element
{
initialContentAlignment: go.Spot.Center, // center the content
"undoManager.isEnabled": true, // enable undo & redo
hoverDelay: 100, // controls how long to wait motionless (msec) before showing Adornment
allowDragOut: false
});
myDiagram.nodeTemplate =
$1(go.Node, "Auto",
{ locationSpot: go.Spot.Center },
$1(go.Shape, "RoundedRectangle",
{ fill: "orange" }),
$1(go.Panel, "Horizontal",
{ margin: 3 },
$1("Button",
{ margin: 2,
click: edit },
$1(go.TextBlock, {
text: '\uf044',
stroke: '#000',
margin: 2,
font: '10px FontAwesome',
editable: false,
isMultiline: false
})),
$1("Button",
{ margin: 2,
click: del },
$1(go.TextBlock, {
text: '\uf1f8',
stroke: '#000',
margin: 2,
font: '10px FontAwesome',
editable: false,
isMultiline: false
})),
$1(go.TextBlock,
new go.Binding("text", "key"))
)
);
function edit(e,obj) {
alert(e.key.value);
}
function del(e, obj){
alert("delete");
}
function showMessage(s) {
document.getElementById("changeMethodsMsg").textContent = s;
}