search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Angular Gantt Chart replace onrowcreate with button

Asked by Bcos
3 years ago.

The current demo Gantt Chart is using bottom text field to create a new task

Is that any way to replace that bottom text field with a create button
After click that button will show the dialog box to input info and create a new task

Thank you.

Comment posted by Bcos
3 years ago.

Or just add a button anywhere to create a new gantt task

Answer posted by Dan Letecky [DayPilot]
3 years ago.

You can use your own button and add a new record to config.tasks property (Angular will detect the change) or you can use the direct API tasks.add() method:

Answer posted by Bcos
3 years ago.

Thanks , I able to do this on Angular 8 by refer this example

Here shared some testing code

on ts file:

@ViewChild('gantt', { static: false }) gantt: DayPilotGanttComponent;

public createTask(): void{
this.gantt.control.tasks.add(new DayPilot.Task({
id: DayPilot.guid(),
text: 'MO',
start: new DayPilot.Date().getDatePart(),
end: new DayPilot.Date().getDatePart().addDays(1),
type: 'Task'

on html file

  • gantt [config]="config" #gantt></daypilot-gantt>
  • <button

(click)="createTask()">Add Task</button>

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.