DayPilot.Gantt.tasks.add

The tasks.add() method adds a new link to the JavaScript Gantt Chart and updates the view.

Declaration

DayPilot.Gantt.tasks.add(task);

Parameters

  • task (DayPilot.Task or source data object) - the task to be added

Description

This methods updates the view immediately. When adding more tasks to a Gantt chart that is already initialized, it's faster to use bulk task loading.

Example

<div id="gantt"></div>

<script>
  const gantt = new DayPilot.Gantt("gantt");
  gantt.init();

  gantt.tasks.add({
      id: "task-1",
      start: "2028-01-01",
      end: "2028-01-02",
      text: "Task 1"
  });

</script>