Skip to main content

drag_link

Description

Specifies the text of tooltips that are displayed when the user creates a new dependency link

drag_link: (from: string | number, from_start: boolean, to: string | number, to_start: boolean) => string;

Parameters

  • from - (required) string | number - the id of the source task
  • from_start - (required) boolean - true, if the link is being dragged from the start of the source task, false - if
    from the end of the task
  • to - (required) string | number - the id of the target task( 'null' or 'undefined', if the target task isn't specified yet)
  • to_start - (required) boolean - true, if the link is being dragged to the start of the target task, false - if
    to the end of the task

Returns

  • text - (string) - html text which will be rendered in the gantt

Example

gantt.templates.drag_link = function(from, from_start, to, to_start) {
const sourceTask = gantt.getTask(from);

let text = `From:<b> ${sourceTask.text}</b> ${(from_start?"Start":"End")}<br/>`;
if(to){
const targetTask = gantt.getTask(to);
text += `To:<b> ${targetTask.text}</b> ${(to_start?"Start":"End")}<br/>`;
}
return text;
};