checks whether the specified link is correct
link | object | the link object |
boolean | true, if the link is correct. Otherwise, false |
const link = {
source:2,
target:2,
type:gantt.config.link.start_to_start
};
if(gantt.isLinkAllowed(link))// -> false (because source==target)
gantt.addLink(link);
The cases when a link is considered as incorrect:
The method invokes the onLinkValidation event. Therefore, if the onLinkValidation event returns false
, a link will be also considered as incorrect.
Note, there is the 2nd way to call the method:
gantt.isLinkAllowed(from, from_start, to, to_start )
where
For example, the code above you alter as in:
//var link = {
// source:2,
// target:2,
// type:gantt.config.link.start_to_start
//};
if(gantt.isLinkAllowed(2, true, 2, true))// -> false (because source==target)
//do something
Back to top