adds a new task and opens the lightbox to confirm
task | NewTask | optional, the task object |
parent | string | number | optional, the parent's id |
index | number | optional, the position the task will be added into (0 or greater) |
string| number | the task's id |
var taskId = gantt.createTask({
id:10,
text:"Task #5",
start_date:"02-09-2013",
duration:28
}, "project_2", 2);
If you set the index parameter with the value from 0 and greater, a task will be added to the specified position in the branch. Otherwise, the task will be added to the end of the tasks' branch.
The method invokes the onTaskCreated event. Note, the event fires before the new task is added to the dataset that allows you to cancel saving of this task at all,for example, if the user clicks 'Cancel' button in the lightbox.
The final order of events that fire when you create a task with the createTask() method: