Topic: Preselect multiple Values in mdb-select
bfk.portal
pro asked 7 years ago
pushOrganisationsIntoMultiSelect() {
this.allOrganisationsMultiSelect= [];
this.allOrganisations.forEach(organisation=> {
this.allOrganisationsMultiSelect.push({value:organisation.id, label:organisation.name, selected:true});
this.selectedValue=organisation.id;
});
}
But that didn't work out so I tried this work around but this didn't work for all use cases:
this
.organisationSelect
.optionList
.options
.forEach(option => {
this
.participants
.forEach(participant => {
if (option.wrappedOption.label === participant.name) {
option.selected = true;
}
});
});
But it didn't work everywhere so i wanted to ask if there is a better way to do it.
with best regards,
Matthias Herzog
Arkadiusz Idzikowski
staff answered 7 years ago
this.allOrganisationsMultiSelect = [...this.allOrganistaionsMultiSelect,{value:organisation.id, label:organisation.name, selected:true}];
Regards, Arek FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: 6.2.2
- Device: Desktop
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No