DayPilot.Gantt Constructor

The DayPilot.Gantt constructor creates a JavaScript Gantt chart instance bound to a placeholder element and optionally initializes it using a configuration object.

Declaration

new DayPilot.Gantt(id, options)

Parameters

Notes

In addition to the standard events and properties, the options parameter also supports these special properties:

  • tasks - initial task array that will be loaded to tasks.list

  • scrollTo - initial scroll position (DayPilot.Date object or string in ISO 8601 format)

Example

HTML

<div id="dp"></div>

JavaScript

const gantt = new DayPilot.Gantt("dp");
gantt.theme = "gantt_white";
gantt.tasks.list = [
  { id: 1, start: "2015-01-01T00:00:00", end: "2015-01-01T15:00:00", text: "Task 1" }
];
gantt.init();
gantt.scrollTo("2015-01-01");

Initialization with properties

const gantt = new DayPilot.Gantt("dp", {
  theme: "gantt_white",
  tasks: [
    { id: 1, start: "2015-01-01T00:00:00", end: "2015-01-01T15:00:00", text: "Task 1" }
  ],
  scrollTo: "2015-01-01"
});
gantt.init();

See Also

DayPilot.Gantt Properties

DayPilot.Gantt Events

Task Loading [doc.daypilot.org]

Task Hierarchy [doc.daypilot.org]

DayPilot.Gantt Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript