|
[app.component.html]
<button ejs-button id='addRecord' (click)='add()'>Add New Record</button>
<ejs-gantt id="ganttDefault" #editing height="100%" [dataSource]="data"
" (actionComplete)="actionComplete($event)">
</ejs-gantt>
[app.component.ts]
public ngOnInit(): void {
this.data = [];
..////
}
public actionComplete(args: any): void {
if (args.action === "add" && args.requestType === "add") {
var obj = document.getElementById("ganttDefault").ej2_instances[0];
setTimeout( () => {
obj.refresh();
}, 100);
}
}
public add(): void {
let record: object = {
TaskID: 9,
TaskName: 'Identify Site location',
StartDate: new Date('04/02/2019'),
Duration: 3,
Progress: 50
};
this.ganttObj.editModule.addRecord(record,'Top');
}; |