I have similar drag and drop palette and diagram as shown in this sample: Simulating Input Events
But here if we drag and drop multiple Alpha nodes. The count increment is happening as the text Binding is with the Key. Which is why we get Alpha, Alpha1, Alpha2 etc.
I want this same increment to happen with a custom node property called ‘componentName’.
my palette structure for a node will be something like this:
{
name: ‘Trigger’,
componentName: ‘Sensor’,
}
Now when i drag multiple components from this palette, i want the names to be Sensor, Sensor1, Sensor2 etc.
How can i achieve this?
This is what I have tried:
$(go.TextBlock, ‘’,
{
row: 0, column: 1,
margin: 10,
textAlign: ‘left’,
verticalAlignment: go.Spot.TopRight,
background: ‘white’,
width: 70,
height: 30,
maxLines: 1,
overflow: go.TextBlock.OverflowEllipsis,
},
new go.Binding(‘text’, ‘’, function(data) {
console.log('data in concat function: ', data);
return data.componentName + Math.abs(data.key);
}).makeTwoWay())
But this only reflects on the View, But my model data is not updated.