-
Notifications
You must be signed in to change notification settings - Fork 222
Open
Description
Bug description:
I am making multiple select using sui-multiselect but since the options list are too heavy (more than 65000 results), I decided to use remote lookup options. All is working fine in case of search and select one option from the list. But I don't get how to preselect some options while initializing the form. Or on some other action on some other element.
Code:
component.html
<sui-multi-select class="selection" [placeholder]="'Select Organisations'
[(ngModel)]="registration.allowed_organisations.organisations"
[optionsLookup]="organisationsLookup"
[labelField]="'name'" [isSearchable]="true" [maxSelected]="100" #multiSelect>
<sui-select-option *ngFor="let option of multiSelect.filteredOptions" [value]="option">
</sui-select-option>
</sui-multi-select>
component.ts
public organisationsLookup = async (query: string) => {
console.log("Org. QR: " + query);
if (query) {
const pr = new Promise<string>(resolve => {
this.opportunityService.getAutoComplete(query, "Organisation").subscribe(
data => {
const organisations = data.data;
resolve(organisations);
}
);
});
return pr;
} else {
return [];
}
};
Version of Angular, ng2-semantic-ui, and Semantic UI:
Angular: 4.4.3
ng2-semantic-ui: 0.9.6