Hi,
Loving Gantt V1.3 nice job guys.
I was wondering if there was an easy way to programmatically create tasks and sub tasks and sub sub tasks etc?
I am trying to load my tasks out of a database so I am storing a parent Id of any given task. I am however running into problems. It seems like you have to create the tasks in order and the assign the tasks parent in reverse order. For example :
var project1 = new GanttProjectInfo(1, "Applet redesign", new Date(2010, 5, 11));
var parentTask2 = new GanttTaskInfo(3, "Hosted Control", new Date(2010, 6, 7), 190, 80, "1");
var parentTask5 = new GanttTaskInfo(5, "J# interfaces", new Date(2010, 6, 14), 60, 70, "6");
var parentTask123 = new GanttTaskInfo(123, "use GUIDs", new Date(2010, 6, 14), 60, 70, "");
parentTask5.addChildTask(parentTask123);
parentTask2.addChildTask(parentTask5);
project1.addTask(parentTask2);
so this code (from one of the examples) is:
create project
create task2
create task5
create task123
then in reverse :
Assign task 123 to task 5
Assign task 5 to task 2
Assign task 2 to project
Obviously when reading a lot of tasks out of a database in a for loop you only have the data once and looping backwards through them to assign them has to be done in another for loop.
You can assign and create data at the same time using :
parentTask2.addChildTask(new GanttTaskInfo(6, "Task D", new Date(2010, 6, 10), 30, 80, "14"));
create and assign task 6 to task 2
However this only works for sub tasks and not sub sub tasks or sub sub sub tasks and so on.
Am I missing an easy way to create and assign tasks without using 2 loops?
Hope this made sense
Cheers
Nic