I am using ng-multiselect dropdown in my angular code. While all the onSelect, onSelectAll, onDeSelect methods are working fine, onDeselctAll method doesn't receive the array of items deselected. I checked in the official site but it was of no use : https://www.npmjs.com/package/ng-multiselect-dropdown. Any idea where I might be going wrong? PFB the code snippet:
.html file
<ng-multiselect-dropdown *ngIf="filteredSids.length > 0"
[data]="filteredSids"
[disabled]="false"
[(ngModel)]="selectedSids"
(onSelect)="selectedSIDs($event); onItemSelect($event)"
(onSelectAll)="onSelectAll($event)"
(onDeSelect)="onItemDeSelect($event)"
(onDeSelectAll)="onDeSelectAll($event)"
[settings]="dropdownSettings"
formControlName="sidControl">
</ng-multiselect-dropdown>
.ts file
onSelectAll(selectedSIDList: Array<string>): void {
selectedSIDList.forEach(sid => {
this.selectedSIDs(sid);
this.onItemSelect(sid);
});
}
onItemDeSelect(deselectedSID: any): void {
this.selectedSIDList = this.selectedSIDList.filter(s => s != deselectedSID);
this.selectedSIDList.forEach(sid => {
this.onItemSelect(sid);
});
}
onDeSelectAll(items: any){
console.log(items); // items is an empty array
}