I've got a multi-select dropdown with a long list of options. Currently, when I choose a single item, it triggers the Onselect
event and adds data from the newArrayAfterProjectFilter
array to the myDataList
based on certain conditions in the OnselectErp
function. However, I need to figure out how to select multiple items from the dropdown and have each one trigger the OnselectErp
function individually, rather than only processing the last selected item.
Does anyone know the correct way to achieve 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)
}