Events
The Events option in the javascriptgantt library offers a comprehensive framework for managing interactions within the Gantt chart. By attaching events to the javascriptgantt library, users can set up and customize handlers for key actions such as task creation, updates, deletions, and various user interactions. This allows developers to tailor specific responses to user actions, ensuring the Gantt chart's behavior aligns with project management workflows and requirements. The Events option significantly enhances the chart's interactivity and responsiveness, providing a seamless and intuitive user experience.
On Task DblClick
Triggered when Double clicked on the task
javascriptgantt.attachEvent("onTaskDblClick", (event) => {
console.log("onTaskDblClick: ", event);
});
On before Task DblClick
Triggered before Double clicked on the task
javascriptgantt.attachEvent("onBeforeTaskDblClick", (event) => {
console.log("onBeforeTaskDblClick: ", event);
if(event.task.id === 3){
return false;
}
});
return false if you want to prevent the task DblClick.
On Link DblClick
Triggered when Double clicked on the link
javascriptgantt.attachEvent("onLinkDblClick", (event) => {
console.log("onLinkDblClick: ", event);
});
On Before Link Add
Triggered before the link added
javascriptgantt.attachEvent("onBeforeLinkAdd", (event) => {
console.log("onBeforeLinkAdd: ", event);
});
On Link Add
Triggered when link added
javascriptgantt.attachEvent("onLinkAdd", (event) => {
console.log("onLinkAdd: ", event);
});
On Delete Link
Triggered when link deleted
javascriptgantt.attachEvent("onDeleteLink", (event) => {
console.log("onDeleteLink: ", event);
});
On Before Task Drag
Triggered before the task dragging
javascriptgantt.attachEvent("onBeforeTaskDrag", (event) => {
console.log("onBeforeTaskDrag: ", event);
if (event.task.children.length !== 0) {
return false;
} else {
return true;
}
});
return flase if you don't want to let the task drag.
On Task Drag
Triggered on the dragging of the task
javascriptgantt.attachEvent("onTaskDrag", (event) => {
console.log("onTaskDrag: ", event);
});
On Before Task Drop
Triggered before task drop
javascriptgantt.attachEvent("onBeforeTaskDrop", (event) => {
console.log("onBeforeTaskDrop: ", event);
if (event.parentTask.id == 12) {
return false;
}
});
return flase if you don't want to let the task drop at the current position.
On After Task Drag
Triggered after the dragging of the task
javascriptgantt.attachEvent("onAfterTaskDrag", (event) => {
console.log("onAfterTaskDrag: ", event);
});
On Task Delete
Triggered when the task deleted
javascriptgantt.attachEvent("onTaskDelete", (event) => {
console.log("onTaskDelete: ", event);
});
On After Task Update
Triggered after the task updated
javascriptgantt.attachEvent("onAfterTaskUpdate", (event) => {
console.log("onAfterTaskUpdate: ", event);
});
On Scroll
Triggered when you scroll gantt
javascriptgantt.attachEvent("onScroll", (event) => {
console.log("onScroll: ", event);
});
On Resize
Triggered on window resize
javascriptgantt.attachEvent("onResize", (event) => {
console.log("onResize: ", event);
});
On Timeline cell click
Triggered when clicked on the timeline cell
javascriptgantt.attachEvent("onCellClick", (event) => {
console.log("onCellClick: ", event);
});
On Request FullScreen
Triggered when requested Fullscreen
javascriptgantt.attachEvent("onRequestFullScreen", (event) => {
console.log("onRequestFullScreen: ", event);
});
On Exit FullScreen
Triggered when exited Fullscreen
javascriptgantt.attachEvent("onExitFullScreen", (event) => {
console.log("onExitFullScreen: ", event);
});
On Task Tree Toggle
Triggered when task tree toggled
javascriptgantt.attachEvent("onTaskToggle", (event) => {
console.log("onTaskToggle: ", event);
});
On Taskbar Color Change
Triggered on taskbar color change
javascriptgantt.attachEvent("onColorChange", (event) => {
console.log("onColorChange: ", event);
});
On Select date range on drag
Select the start & end date through Drag
javascriptgantt.attachEvent("selectAreaOnDrag", (event) => {
console.log("selectAreaOnDrag: ", event);
});
On After Progress Drag
Triggered after task progress drag
javascriptgantt.attachEvent("onAfterProgressDrag", (event) => {
console.log("onAfterProgressDrag: ", event);
});
On Before Progress Drag
Triggered before task progress drag
javascriptgantt.attachEvent("onBeforeProgressDrag", (event) => {
console.log("onBeforeProgressDrag: ", event);
if (event.task.parent === 0) {
return false;
} else {
return true;
}
});
return flase if you don't want to let the task progress drag.
On Auto Scheduling tasks
Triggered on auto scheduling tasks.
javascriptgantt.attachEvent("onAutoScheduling", (event) => {
console.log("onAutoScheduling: ", event);
});
On before save task
Triggered on blur when you use inline eitor of gantt.
javascriptgantt.attachEvent("onBeforeSave", (event) => {
console.log("onBeforeSave: ", event);
});
On save task
Triggered on blur when you use inline eitor of gantt.
javascriptgantt.attachEvent("onSave", (event) => {
console.log("onSave: ", event);
});