Getting child tasks


Is there any way to get a Task’s childtasks programatically ? (JS)


Hi, there is only one undocumented way, GanttTask class has an internal array childPredTask.

var project12 = ganttChart.getProjectById(12);
var task33 = project.getTaskById(33);
var childTasks = task33.childPredTask;
for (var i = 0; i < childTasks.length; i++)
    var child  = childTasks[i];

We will add a public method for that. Thank you.

Added the following code:

 * @desc: returns array of child tasks
 * @type: public
 * @topic: 0
GanttTask.prototype.getChildTasks = function()
    return this.childPredTask;

You may add it to your current code so that it will be compatible with the future releases.


Well should it not be :

GanttTask.prototype.getChildTasks = function() { return this.childTask; };