onTaskCreated
Description
Fires when a user creates a new task by pressing the'+' button in a grid, or when the createTask method is called
onTaskCreated: (task: Task) => boolean;
Parameters
task- (required) Task - the object of a new task
Returns
result- (boolean) - returningfalsewill cancel the creation of a new task, returningtruewill continue the default processing
Example
gantt.attachEvent("onTaskCreated", function(task){
task.projectId = 1;
return true;
});
Details
The event fires before a new task is displayed, which allows you to set default values or cancel the creation of a task.
By the time this event is fired, the new task is already available in the datastore via the getTask method.
If the event handler returns false, the task will be removed from the datastore without firing the onAfterTaskDelete event.
The final order of events that fire when you create a task with the createTask method is: