Skip to content

Commit

Permalink
Merge pull request #14747 from primefaces/refactor
Browse files Browse the repository at this point in the history
Fixed #14701 - Dropdown | removing a letter from filter that comes af…
  • Loading branch information
cetincakiroglu authored Feb 7, 2024
2 parents a2df2b3 + eaa06c7 commit 9c9db74
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/components/dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -912,11 +912,11 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
!_filterBy && !this.filterFields && !this.optionValue
? this.options.filter((option) => {
if (option.label) {
return option.label.toLowerCase().indexOf(this._filterValue().toLowerCase()) !== -1;
return option.label.toLowerCase().indexOf(this._filterValue().toLowerCase().trim()) !== -1;
}
return option.toLowerCase().indexOf(this._filterValue().toLowerCase()) !== -1;
return option.toLowerCase().indexOf(this._filterValue().toLowerCase().trim()) !== -1;
})
: this.filterService.filter(options, this.searchFields(), this._filterValue(), this.filterMatchMode, this.filterLocale);
: this.filterService.filter(options, this.searchFields(), this._filterValue().trim(), this.filterMatchMode, this.filterLocale);

if (this.group) {
const optionGroups = this.options || [];
Expand Down Expand Up @@ -1774,7 +1774,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV
}

onFilterInputChange(event: Event | any): void {
let value: string = (event.target as HTMLInputElement).value?.trim();
let value: string = (event.target as HTMLInputElement).value
this._filterValue.set(value);
this.focusedOptionIndex.set(-1);
this.onFilter.emit({ originalEvent: event, filter: this._filterValue() });
Expand Down

0 comments on commit 9c9db74

Please sign in to comment.