Currently, given a multiselect with some data and allowCustom = true, if the user types "sm" and hits Enter, the control finds the first item in data that starts with "sm" and automatically selects that.
Repro: https://stackblitz.com/edit/angular-buffxv?file=app/app.component.ts
Looking at the code for the MultiSelect, the auto selection seems to happen because of findIndex(text, startsFrom = 0); the offending line: text && itemText.startsWith(text);
Ideally, the MultiSelect should give me a hook to determine what item is selected. Maybe hit valueNormalizer on Enter
Whenever we type search text in MultiSelect Dropdown and focus out, the search text gets cleared.
Please provide an option for keeping the typed value in the MutliSelect input, without having to select anything from the dropdown.
Before this directive we do it this way:
public ngAfterViewInit() {
const contains = (value: string) => (object: IBaseObjectConfigurationField) => object.name.toLowerCase().indexOf(value.toLowerCase()) !== -1;
this.multiSelect.filterChange
.asObservable()
.pipe(
switchMap(value =>
from([this.collection])
.pipe(
tap(() => {
this.multiSelect.loading = true;
}),
delay(value ? 350: 0),
map(data => data.filter(contains(value))),
),
),
)
.subscribe(x => {
this.filteredCollection = x;
this.multiSelect.loading = false;
});
}
Please provide a (global) option for red line!
Provide an option to focus programmatically a multiselect item, in order to prevent the popup list from scrolling when the last item is selected.
Here is an example:
https://stackblitz.com/edit/angular-qpbow1-awhxbr?file=app%2Fapp.component.ts
Provide a way to easily clear the selected values from a multiselect. Similar functionality can be achieved by achieved by setting the value of the multiselect to an empty array, however this does not deselect the items in the dropdown portion of the multiselect, and the items must be clicked twice to reselect them. The clear should function the exact same as the built in clear button.
I know this can be done with the change event but that is just a workaround. Would use this from UI for angular.
We need single tagmode option for multiselect dropdown property in Angualr 2