The tasks.add() method adds a new link to the JavaScript Gantt Chart and updates the view.
DayPilot.Gantt.tasks.add(task);
task (DayPilot.Task or source data object) - the task to be added
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.
<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>