I have a multi-select drop-down with many items to select. As of now When I select single item, the item is passed to Onselect event and based on condition the respective data from another array newArrayAfterProjectFilter is pushed tomyDataList as shown below in OnselectErp. As per my requirement When I try to select 2nd item in dropdown, only the 2nd item is pushed to OnselectErpfunction, not both items(1st and 2nd).
How to correctly do this?
<ng-multiselect-dropdown *ngIf="showDropDown"
[placeholder]="'Erp Rfq Number'" [data]="dropdown_Erp"
[settings]="dropdownSettings" (onSelect)="OnselectErp($event)">
</ng-multiselect-dropdown>
OnselectErp(item: any) {
this.myDataList = [];
this.newArrayAfterProjectFilter.forEach(element => {
if (element.properties.map.aclrq_rfqNum == item.item_text) {
this.myDataList.push(element);
}
});
console.log(this.myDataList)
}
item:YourItemTypewhereas multiselect should yielditem:Array<MyItemType>.(onSelect)will fire each time you select an item so it will not serve your purpose. One solution is to have a button. On click of button you first read all selected items and then filter the table.