We want to change the color of the link/edge to red whenever there is any sort of validation error happening in the link. But, I’ve observed that only for the last link the color of all segments is getting red whereas for other links the top segment is not getting changed as it’s getting overlapped by the later link segments. We want to get the link color completely red whenever any sort of validation error is happening. Please let us know how we can achieve that?
Are you using a binding on the link path’s Shape.stroke property to control its color, with a source data property indicating that there is an error? Something like this?
new go.Binding("stroke", "error", e => e ? "red" : "gray")
If so, the whole link path is in fact updated to be red, but the user cannot see it along the first two segments because a non-error link is in front of it. So you just need to change the z-ordering so that error links are in front of non-error links.
You could add a binding on the whole link template like:
$(go.Link,
{ . . . },
new go.Binding("layerName", "error", e => e ? "Foreground" : ""),
. . .
)
I wanted to understand is this the right way to bind the zOrder property, cause even when I’m giving zOrder value 100 in my diagram Json for _isInvalid property true (error property), then also I’m not expecting the behaviour!
If there’s no data.error property, or if its value is undefined, the binding is not evaluated. That’s why it’s important to set the property to the default value that you want.