Preventing closed loop in GoJS group to group link creation

419 views Asked by At

for my project I am using GOJs libary . So far all of my requirements are fulfilled but I am struck in one point regarding validation when creating group to group link. Basically I donot want to allow my user to create a closed loop like this.What will be the logic in this case. I am attaching a screenshot for the scenario for your reference.

enter image description here

1

There are 1 answers

0
Walter Northwoods On

The simple answer is: myDiagram.validCycle = go.Diagram.CycleDestinationTree;

However, it turns out with further discussion that this solution is too broad, because you do want to allow users to draw reflexive links. https://forum.nwoods.com/t/preventing-closed-loop-in-gojs-group-to-group-link-creation/7848 In that case the only solution is to implement a custom linkValidation predicate. Read about this at http://gojs.net/latest/intro/validation.html, and search the samples for examples.