api.on(event, handler). To intercept and potentially cancel an action before it is applied, use api.intercept() instead.
add-task
Fired after a new task is added to the chart.The ID of the newly created task.
The insertion mode used to place the task relative to the target.
update-task
Fired after a task’s properties are changed.The ID of the updated task.
delete-task
Fired after a task is deleted.The ID of the deleted task.
The ID of the sibling or parent task that was adjacent to the deleted task. Useful for recalculating aggregated values after deletion.
move-task
Fired when a task is moved to a new position in the task tree (reordering in the grid) or dragged along the timeline.The ID of the moved task.
The original parent or sibling ID of the task before the move.
How the task was repositioned relative to the target.
true while a drag is still in progress (live preview). false when the move is finalized. Filter on inProgress: false to perform side-effects only once.copy-task
Fired after a task is duplicated (e.g. via the context menu Copy action).The ID of the newly created copy.
drag-task
Fired continuously while a task bar is being dragged on the chart (both move and resize). Also fires once when the drag ends withinProgress: false.
The ID of the task being dragged.
Current pixel offset from the left edge of the chart area.
Current pixel width of the task bar.
Present when the task is being reordered vertically in the grid.
undefined when the task is being moved or resized horizontally on the chart.true during a live drag; false on the final drop.sort-tasks
Fired after the task list is sorted by a column.The column key used to sort (e.g.
"text", "start", "duration").The sort direction.
When
true, this sort is being added to an existing multi-column sort.show-editor
Fired when the editor is about to open for a task, or when it is closed.The ID of the task being edited.
null when the editor is closing.zoom-scale
Fired after the zoom level changes (e.g. via Ctrl+scroll).The direction of the zoom: positive values zoom in, negative values zoom out.
The horizontal pixel offset of the mouse pointer at the time of the zoom, used to keep the view centered on the cursor position.
request-data
Fired when the Gantt needs to lazy-load child data for a task node that has not yet been fetched from the server.The ID of the parent task whose children need to be loaded.
api.exec('provide-data', ...) to deliver the results.
select-task
Fired after the task selection changes.The ID of the task that was clicked or selected.
true when Ctrl/Cmd was held during the click (multi-select toggle).true when Shift was held during the click (range selection).true when the chart should scroll to bring the selected task into view.open-task
Fired when a summary task node is expanded or collapsed in the grid.The ID of the task being toggled.
true to expand, false to collapse.add-link
Fired after a dependency link is created between two tasks.update-link
Fired after a dependency link is updated.The ID of the updated link.
The updated link properties.
delete-link
Fired after a dependency link is deleted.The ID of the deleted link.