DayPilot.Gantt.onBeforeTaskRender

The onBeforeTaskRender event handler fires before a task is rendered. It lets you customize the task data used during rendering.

Declaration

DayPilot.Gantt.onBeforeTaskRender(args)

Parameters

  • args.type (string) - calculated task type: "Task" | "Group" | "Milestone"
  • args.data (DayPilot.Task.data) - task data (a shallow copy of the original data object)

Notes

The args.task.children property is not available in this event.

Examples

JavaScript

const gantt = new DayPilot.Gantt("dp", {
  onBeforeTaskRender: (args) => {
    args.data.cssClass = "important-task";
    args.data.box.html = "Task description";
  },
  // ...
});
gantt.init();

Angular

<daypilot-gantt [config]="config"></daypilot-gantt>
config: DayPilot.GanttConfig = {
  onBeforeTaskRender: (args) => {
    args.data.cssClass = "important-task";
    args.data.box.html = "Task description";
  },
  // ...
};

React

<DayPilotGantt
  onBeforeTaskRender={onBeforeTaskRender}
  {/* ... */}
/>
const onBeforeTaskRender = (args) => {
  args.data.cssClass = "important-task";
  args.data.box.html = "Task description";
};

Vue

<DayPilotGantt
  @beforeTaskRender="onBeforeTaskRender"
  <!-- ... -->
/>
const onBeforeTaskRender = (args) => {
  args.data.cssClass = "important-task";
  args.data.box.html = "Task description";
};

See Also

DayPilot.Task.data

DayPilot.Gantt Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript