The following snippet defines a header named “Note” on a contextMenu of a node template:
$(
go.TextBlock,
'Note',
{
font: this.defaultFont,
stroke: this.colors.textColor,
desiredSize: new go.Size(102, 25),
alignmentFocus: go.Spot.Left,
margin: new go.Margin(10, 0, 0, 15)
},
new go.Binding('stroke', 'disableNotes', c =>
c ? 'lightgray' : this.colors.textColor
)
),
when I dragged this node onto the canvas:
{
id: 21,
text: 'Log Message',
...
notes: ''
},
Since disableNotes is not defined, the disableNotes Binding is not evaluated, and “Note” is of stroke this.colors.textColor (black) - correct behaviour.
Problem occurs when I dragged the following node onto the canvas:
{
id: 12,
text: 'Execute Powershell',
...
disableNotes: true
}
When I clicked the contextMenu of ‘Log Message’ node, the “Note” heading becomes lightgray!
It appears that ‘Execute Powershell’ and ‘Log Message’ are sharing the same disableNotes attribute. This makes no sense, as they each have their own data object as I have shown above.
Setting “disableNotes” of ‘Execute Powershell’ would inadvertently cause the Binding of ‘Log Message’ to reevaluate. How do I ensure “Note” binding maps to the respective data objects of ‘Log Message’ and ‘Execute Powershell’?
“Bindings will be shared by all copies of the template’s GraphObjects.”