I'm using Gantt-chart in my angular project.
and I want to filter the data based on checkbox click.
but when I associate filtered list to Gantt-chart it gives error.
Critical and Milestone both are filters.
if I click critical then I got the filtered list in console but it's not assigned to the chart. and I got this error.
<div class="row">
<div class="schedule-wrapper">
<mat-form-field class="lookAhedSelect">
<mat-label>Look Ahead</mat-label>
<mat-select (change)="onLookAheadChange($event)">
<mat-option *ngFor="let item of lookAhead" [value]="item.value">
{{item.viewValue}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox type="checkbox" (change)="changedMilestone($event)" name="milestone">Milestone</mat-checkbox>
<mat-checkbox type="checkbox" (change)="changed($event)" name="critical">Critical</mat-checkbox>
<button class="upload-schedule">Import Schedule
<i class="fa fa-upload" aria-hidden="true"></i>
<input name="imageUrl" class="form-control-file" name="Upload Schedule" type="file" (change)="handleInputChange($event)" />
</button>
</div>
</div>
<div class="col-sm-12">
<ejs-gantt
#gantt1
id="ganttDefault"
height="550px"
[labelSettings]="labelSettings"
[allowFiltering]='true'
[allowSorting]= 'true'
[dataSource]="schedulelist"
[taskFields]="taskSettings"
[timelineSettings]="timelineSettings"
[editSettings]="editSettings"
[toolbar]="toolbar"
allowExcelExport='true'
(queryTaskbarInfo) = "queryTaskbarInfo($event)"
(toolbarClick)="toolbarClick($event)"
(actionComplete)="onActionComplete($event)"
[enableVirtualization] = "true"
></ejs-gantt>
</div>
// ts code
this.taskSettings = {
id: 'uniqueId',
name: 'activityName',
startDate: 'startDate',
endDate: 'endDate',
duration: 'duration',
isCritical: 'isCritical',
child: 'subtasks',
dependency: 'predecessors',
};
this.labelSettings = {
leftLabel: 'Task ID: ${taskData.activityCode}',
}
this.timelineSettings = {
timelineViewMode: 'Month',
timelineUnitSize: 150,
};
this.editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
this.toolbar = ['Add', 'Edit', 'Update', 'ExpandAll', 'CollapseAll', 'Search', 'ExcelExport', 'CsvExport'];
getCriticalList() {
this.showLoader = true;
if (this.isChecked) {
let criticalList = [];
this.schedulelist.forEach((ele: any) => {
if (ele.isCritical === true) {
criticalList.push(ele);
}
});
console.log(criticalList);
if (criticalList) {
this.schedulelist = [];
this.schedulelist = criticalList;
this.showLoader = false;
}
else{
this.showLoader = false;
}
}
}