calculateTaskLevel
calculates the level of nesting of a task
number calculateTaskLevel(Task task);
task | Task | the task's object |
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;
});
See also
Back to top