onTaskCreated

fires when user creates a new task by pressing '+' button in a grid, and also when the createTask method is called

boolean onTaskCreated(object task){ ... };

Parameters

taskobjectthe object of the new task

Returns

booleandefines whether the default action of the event will be triggered (true) or canceled (false)

Example

gantt.attachEvent("onTaskCreated", function(task){
    //any custom logic here
    return true;
});

Details

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:

  1. onTaskCreated
  2. onBeforeLightbox
  3. onLightbox
  4. onAfterLightbox
  5. onAfterTaskAdd
  6. onBeforeTaskAdd
See also
Back to top