Hi , i have a question
In the flowchart example http://gojs.net/latest/samples/flowchart.html , i tried to implement a function that enable the user to change the category of a specific node by the context menu and i did like this:
//create a context menu
$$(“ContextMenuButton”,
$$(go.TextBlock, “change type”),
{ click: function(e, obj) { ChangeType(e,obj); } },
…
//in function ChangeType
…
myDiagram.startTransaction(“Change Type”);
<span =“apple-tab-span”=“” style=“white-space:pre”> var holdNode = obj.part.adornedPart;
<span =“apple-tab-span”=“” style=“white-space:pre”> if (holdNode!=undefined && holdNode!=null)
<span =“apple-tab-span”=“” style=“white-space:pre”> {
<span =“apple-tab-span”=“” style=“white-space:pre”>
<span =“apple-tab-span”=“” style=“white-space:pre”> holdNode.data.category = “end”
<span =“apple-tab-span”=“” style=“white-space:pre”>
<span =“apple-tab-span”=“” style=“white-space:pre”> }
myDiagram.commitTransaction(“Change Type”);
this doesn’t work so i try to modify in the NodeDataArray
for (var i=0; i<=myDiagram.model.nodeDataArray.length-1;i++)
<span =“apple-tab-span”=“” style=“white-space:pre”> {
<span =“apple-tab-span”=“” style=“white-space:pre”> if (myDiagram.model.nodeDataArray.key==holdNode.key)
<span =“apple-tab-span”=“” style=“white-space:pre”> {
<span =“apple-tab-span”=“” style=“white-space:pre”> myDiagram.model.nodeDataArray.category = “end”;
<span =“apple-tab-span”=“” style=“white-space:pre”>
<span =“apple-tab-span”=“” style=“white-space:pre”>
<span =“apple-tab-span”=“” style=“white-space:pre”> }
<span =“apple-tab-span”=“” style=“white-space:pre”> }
this doesn’t work either. Is there anyway i can do this?
Thanks