DayPilot.Gantt Constructor

Declaration

DayPilot.Gantt(id, options);

Parameters

  • id - id of the placeholder <div> element
  • options - object, properties to be set

You can set the Gantt properties using options parameter. It accepts all Gantt properties and events and the following special properties:

  • "tasks" - task array, 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

var 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

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