isCriticalTask

checks whether the specified task is critical

boolean isCriticalTask(Task task);
taskTaskthe task's object
boolean'true' if the specified task is critical, 'false' otherwise

Available only in PRO Edition

Example

const tasks = {
    data:[
       {id:1, text:"Project #1", start_date:"01-04-2023", duration:18, type:"project"},
       {id:2, text:"Task #1", start_date:"02-04-2023", duration:8, parent:1},
       {id:3, text:"Task #2", start_date:"13-04-2023", duration:8, parent:1}
    ],
    links:[
       {id:1, source:1, target:2, type:"1"},
       {id:2, source:2, target:3, type:"0"}
    ]
};
 
gantt.config.highlight_critical_path = true; gantt.init("gantt_here");
gantt.parse(tasks);
 
gantt.isCriticalTask(gantt.getTask(2));// ->'false' gantt.isCriticalTask(gantt.getTask(3));// ->'true'

Related samples

Details

This functionality is available in the PRO edition only.

This method is defined in the critical_path extension, so you need to activate the critical_path plugin. Read the details in the Critical Path article.

See also
Back to top