Skip to content

Commit

Permalink
Fixed #12854 - Multiselect | Multiselect with string array search not…
Browse files Browse the repository at this point in the history
… working
  • Loading branch information
mehmetcetin01140 committed Feb 12, 2024
1 parent ede4271 commit ed2c867
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1038,11 +1038,20 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft
return this.config.translation.aria ? this.config.translation.aria.close : undefined;
}


visibleOptions = computed(() => {
const options = this.group ? this.flatOptions(this.options) : this.options || [];

const isArrayOfObjects = ObjectUtils.isArray(options) && ObjectUtils.isObject(options[0])

if (this._filterValue()) {
const filteredOptions = this.filterService.filter(options, this.searchFields(), this._filterValue(), this.filterMatchMode, this.filterLocale);
let filteredOptions;

if (isArrayOfObjects) {
filteredOptions = this.filterService.filter(options, this.searchFields(), this._filterValue(), this.filterMatchMode, this.filterLocale);
} else {
filteredOptions = options.filter((option) => option.toLocaleLowerCase().includes(this._filterValue().toLocaleLowerCase()));
}

if (this.group) {
const optionGroups = this.options || [];
const filtered = [];
Expand Down

0 comments on commit ed2c867

Please sign in to comment.