Hi, I want to create a new node when doubleclick the Diagram, so I use following code:
this.myDiagram = $(go.Diagram, "myDiagramDiv", {
"undoManager.isEnabled": true,
"clickCreatingTool.archetypeNodeData": { text: "项目名称", source: [] }, // create a new node by double-clicking in background
The ‘source’ is an ‘itemArray’ so in nodeTemplate is like this:
$(go.Panel, "Horizontal", new go.Binding("itemArray", "source"), {
itemTemplate: $(
go.Panel,
"Horizontal",
$(
go.Picture,
{
width: 24,
height: 24,
margin: 8,
},
new go.Binding("source", "icon")
)
),
}),
This ‘source’ are the icons in each node, but when I doubleclick and set some icons in the new node, all the other nodes created by doubleclick has same icons . If I change icons in one node , all the others change together. Can you help with this?