Your code should not be expected to modify the appearance of anything in your diagram because you are modifying a template, not an actual Link.
So if you really want to change the routing of all of the Links in your diagram, you need to iterate over each of the Links to set the Link.routing property:
function reroute() {
myDiagram.startTransaction("toggle all routing");
myDiagram.links.each(function(l) {
l.routing = (l.routing === go.Link.Normal) ? go.Link.AvoidsNodes : go.Link.Normal;
});
myDiagram.commitTransaction("toggle all routing");
}
Hey, Default, my link template was using “AvoidNodes” and then I used the toggle button for “Normal”, In designer, links are changed to normal, however when draw a new link it uses “AvoidNodes”
How to fix this? Should I have to change the routing of link template? How to do that?
Do what you were doing before – in my “reroute” function set myDiagram.linkTemplate.routing to the desired value.
Hmmm, it sounds like toggling each Link’s Link.routing property isn’t what you want to do – you want to set them all to the same value. So you’ll want to change the code accordingly.