getTask

returns the task object

object getTask(string| number id);

Parameters

idstring| numberthe task id

Returns

objectthe task object

Example

gantt.addTask({
    id:7,
    text:"Task #5",
    start_date:"02-09-2013",
    duration:28
}, "pr_2");
 
gantt.getTask(7);
//->{id:7, text:"Task #5", start_date:"02-09-2013", duration:28, 
//   parent:"pr_2", $source:[1,5], $target:[8,13], ...}

Details

The task's object return by the getTask() method contains 2 important properties you may use to get links related to the task:

  • $source - links that comes out from the task.
  • $target - links that comes into task.

The properties are autogenerated and store ids of the coming-in and coming-out links.

var taskObj = gantt.getTask("t1");
 
var sourceLinks = taskObj.$source;        //-> ["l1","l4"] - ids of coming-out links  
var targetLinks = taskObj.$target;       //-> ["l5","l8"] - ids of coming-into links
See also
Back to top