Skip to content

Commit

Permalink
Merge pull request #15985 from primefaces/issue-14454
Browse files Browse the repository at this point in the history
Fixed #14454 - Listbox | filter is not working if options is bind to …
  • Loading branch information
cetincakiroglu authored Jul 11, 2024
2 parents 30cdb1c + c0ebe02 commit a024e9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/components/listbox/listbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,11 @@ export class Listbox implements AfterContentInit, OnInit, ControlValueAccessor,

visibleOptions = computed(() => {
const options = this.group ? this.flatOptions(this._options()) : this._options() || [];
return this._filterValue() ? this.filterService.filter(options, this.searchFields, this._filterValue(), this.filterMatchMode, this.filterLocale) : options;
const filterValue = this._filterValue();

if (this.searchFields[0] === undefined) {
return filterValue ? options.filter((option) => option.toString().toLocaleLowerCase(this.filterLocale).indexOf(filterValue.toLocaleLowerCase(this.filterLocale).trim()) !== -1) : options;
} else return filterValue ? this.filterService.filter(options, this.searchFields, filterValue, this.filterMatchMode, this.filterLocale) : options;
});

constructor(public el: ElementRef, public cd: ChangeDetectorRef, public filterService: FilterService, public config: PrimeNGConfig, private renderer: Renderer2) {}
Expand Down

0 comments on commit a024e9b

Please sign in to comment.