I was facing two issues in this code. i made it two way but when i update High property with another colour , it is not getting updated untill i use “diagram.updateAllTargetBindings” .
this.(go.Link,
{
curve: go.Link.Bezier,
relinkableFrom: true, relinkableTo: true,
toShortLength: 3,
toEndSegmentLength: 40, fromEndSegmentLength: 40
},
this.(go.Shape, // the link shape
{ stroke: “gray” },
new go.Binding(“stroke”, “High”).makeTwoWay()
),
this.$(go.Shape, { toArrow: “Standard” }, new go.Binding(“fill”, “High”).makeTwoWay())
);
eg: modellinkArray i am using { from: srcTableName, to: tgtTableName, fromPort: srcColName, toPort: tgtColName,High:“red”}
i want to validate the property in two way i am unable to make it.
eg:
“”"
modellinkArray i am using { from: srcTableName, to: tgtTableName, fromPort: srcColName, toPort: tgtColName,High:true}
this.$(go.Shape,
{ stroke: “gray” },
new go.Binding(“stroke”, “High”).makeTwoWay((n)=> {return “red”};) // i want to validate here
),
If you have a TwoWay Binding, it must be the case that some code is modifying the GraphObject property that is the target of the binding. What’s even more implausible is that you have two bindings that use “High” as the source property. What code of yours is modifying either the one shape’s Shape.stroke property or the other shape’s Shape.fill property?
If such code does exist, then it makes sense that there be a TwoWay Binding on the property. BUT – it should be the responsibility of that code to do its own validation. It is not the responsibility of the binding mechanism to check for semantic errors.
And my guess is that no such code exists, so you should not be using TwoWay Bindings at all there.
The whole concept of validation should be to prevent users from making mistakes, not to try to fix it up after the wrong change has already been made.