From 94a19bfa8c97481d9d0485ce0f66f8e29a7bbe9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 10 Jan 2024 13:12:29 +0300 Subject: [PATCH] Fixed #14370 --- src/app/components/dropdown/dropdown.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/components/dropdown/dropdown.ts b/src/app/components/dropdown/dropdown.ts index 43cd451fe14..0db7a007900 100755 --- a/src/app/components/dropdown/dropdown.ts +++ b/src/app/components/dropdown/dropdown.ts @@ -896,8 +896,10 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV const options = this.group ? this.flatOptions(this.options) : this.options || []; if (this._filterValue()) { + const _filterBy = this.filterBy || this.optionLabel; + const filteredOptions = - !this.filterBy && !this.filterFields && !this.optionValue + !_filterBy && !this.filterFields && !this.optionValue ? this.options.filter((option) => option.toLowerCase().indexOf(this._filterValue().toLowerCase()) !== -1) : this.filterService.filter(options, this.searchFields(), this._filterValue(), this.filterMatchMode, this.filterLocale); if (this.group) { @@ -1663,7 +1665,7 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV } searchFields() { - return this.filterBy.split(',') || this.filterFields || [this.optionLabel]; + return this.filterBy?.split(',') || this.filterFields || [this.optionLabel]; } searchOptions(event, char) { @@ -1749,4 +1751,3 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV declarations: [Dropdown, DropdownItem] }) export class DropdownModule {} -