updates the specified task
id | string | the task id |
newState | object | the new values of the task |
var taskId = gantt.addTask({
id:10,
text:"Task #10",
start_date:"02-04-2013",
duration:8,
parent:1
});
gantt.getTask(taskId).text = "Task #13"; //changes task's data
gantt.updateTask(taskId); //renders the updated task
The method invokes the onAfterTaskUpdate method.
You can also replace the existing task with new values via setting a new task object as the second parameter of the updateTask method:
var task = {
id: 2, text: 'New task text',
start_date: new Date(2025,03,02),
end_date: new Date(2025,03,04),
$source:1,
$target:2
}
gantt.updateTask(2,task);