DayPilot.Gantt.onTaskClick

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().

Declaration

DayPilot.Gantt.onTaskClick(args)

Parameters

  • args.task - DayPilot.Task object representing the task.

  • args.preventDefault() - cancels the default action.

Examples

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());
};

See Also

DayPilot.Gantt Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript