updateTask

updates the specified task

void updateTask(string id,object newState);

Parameters

idstringthe task id
newStateobjectthe new values of the task

Example

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

Details

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);

Related sample:  Updating task

See also
Back to top