calculateTaskLevel
Description
Calculates the level of nesting of a task
calculateTaskLevel: (task: Task) => number
Parameters
task- (required) Task - the task's object
Returns
level- (number) - the level of a task in the tree hierarchy (zero-based numbering)
Example
gantt.attachEvent("onTaskCreated", function(task){
var level = gantt.calculateTaskLevel(task),
types = gantt.config.types;
//assign task type based on task level
switch (level){
case 0:
task.type = types.project;
break;
case 1:
task.type = types.subproject;
break;
default:
task.type = types.task;
break;
}
return true;
});