The onTaskClick event handler fires when the user clicks a task box in the Gantt Chart, before the default action specified by taskClickHandling.
The default action can be canceled by calling args.preventDefault().
DayPilot.Gantt.onTaskClick(args)args.task - DayPilot.Task object representing the task.
args.preventDefault() - cancels the default action.
JavaScript
const gantt = new DayPilot.Gantt("dp", {
taskClickHandling: "Enabled",
onTaskClick: (args) => {
DayPilot.Modal.alert("Clicked: " + args.task.id());
},
// ...
});
gantt.init();Angular
<daypilot-gantt [config]="config"></daypilot-gantt>config: DayPilot.GanttConfig = {
taskClickHandling: "Enabled",
onTaskClick: args => {
DayPilot.Modal.alert("Clicked: " + args.task.id());
},
// ...
};React
<DayPilotGantt
taskClickHandling="Enabled"
onTaskClick={onTaskClick}
{/* ... */}
/>const onTaskClick = (args) => {
DayPilot.Modal.alert("Clicked: " + args.task.id());
};Vue
<DayPilotGantt
taskClickHandling="Enabled"
@taskClick="onTaskClick"
<!-- ... -->
/>const onTaskClick = (args) => {
DayPilot.Modal.alert("Clicked: " + args.task.id());
};