I am using Gantt Chart in a Tab
When i click the toolbarClick, ganttChart is showing undefined
The same thing i am using in another page where there is NO Tab control for Gantt Chart. And it works fine!!
@ViewChild('gantt', {static: true}) public ganttChart: GanttComponent;
toolbarClick(args: ClickEventArgs): void {
if (args.item.id === 'gantt_pdfexport') {
this.ganttChart.pdfExport();
}else if (args.item.id === 'gantt_excelexport') {
this.ganttChart.excelExport();
} else if(args.item.id === 'gantt_csvexport') {
this.ganttChart.csvExport();
}
};
this.toolbar = ['ExpandAll', 'CollapseAll', 'PdfExport','ExcelExport','CsvExport', 'ZoomToFit', 'ZoomIn', 'ZoomOut'];
<e-tabitem [header]='headerText[1]'>
<ng-template #content>
<div class="col-md-12 ">
<div class="card shadow p-3 mb-1 bg-white rounded ">
<ejs-gantt #gantt id="gantt" height="100%" [dataSource]="ganttData" [taskFields]="taskSettings"
readOnly=true [columns]="columns" [treeColumnIndex]="1" [dayWorkingTime]="dayWorkingTime"
[splitterSettings]="splitterSettings" [timelineSettings]="timelineSettings"
[labelSettings]="labelSettings" [editSettings]="editSettings" [allowSelection]="true"
[includeWeekend]="true"
[highlightWeekends]="true" allowPdfExport='true' allowExcelExport='true' [toolbar]="toolbar" (toolbarClick)="toolbarClick($event)" taskMode="Custom" [enablePredecessorValidation]="false">
</ejs-gantt>
</div>
</div>
</ng-template>
</e-tabitem>