Get the type of a Link

Hi, How can i get the type of a link?
I need it because i want to do the code:

           var modes = gantt.config.drag_mode;
        var targetLinks = task.$target;
        var link = this.getLink(targetLinks[0]);
        if (type == 0) {

            if (link != null) {
                var leftLimit = gantt.getTask(link.source).end_date;


                if (mode == modes.move) {
                    var diff2 = original.duration * (1000 * 60 * 60 * 24);
                    if (+task.start_date < +leftLimit) {
                        task.start_date = new Date(+leftLimit);
                        task.end_date = new Date(+task.start_date + diff2);
                    }
                }

                if (mode == modes.move) {
                    var diff = task.start_date - original.start_date;
                    gantt.eachSuccessor(function (child) {

                        child.start_date = new Date(+child.start_date + diff);
                        child.end_date = new Date(+child.end_date + diff);
                        gantt.refreshTask(child.id, true);
                    }, id);
                }
            }

            else {
                if (mode == modes.move) {
                    var diff = task.start_date - original.start_date;
                    gantt.eachSuccessor(function (child) {

                        child.start_date = new Date(+child.start_date + diff);
                        child.end_date = new Date(+child.end_date + diff);
                        gantt.refreshTask(child.id, true);
                    }, id);
                }
            }
        }
        if (type ==1){

// code

}

Hello,
You can get the link type from the type property:
https://docs.dhtmlx.com/gantt/desktop__crud_dependency.html
https://docs.dhtmlx.com/gantt/api__gantt_links_config.html

1 Like