From d6c3eae1438443d300c3ca99613ef126248f734b Mon Sep 17 00:00:00 2001 From: G Vineeth Prakash Date: Tue, 28 Nov 2023 10:04:45 +0530 Subject: [PATCH] 14194: Fixed filter with default 'label' field --- src/app/components/multiselect/multiselect.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/components/multiselect/multiselect.ts b/src/app/components/multiselect/multiselect.ts index e36e8a8a48e..0dde56d24be 100755 --- a/src/app/components/multiselect/multiselect.ts +++ b/src/app/components/multiselect/multiselect.ts @@ -1285,7 +1285,7 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft } searchFields() { - return this.filterFields || [this.optionLabel]; + return (this.filterBy || this.optionLabel || 'label').split(','); } findNearestSelectedOptionIndex(index, firstCheckUp = false) { @@ -2052,12 +2052,10 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft activateFilter() { if (this.hasFilter() && this._options) { - let searchFields: string[] = (this.filterBy || this.optionLabel || 'label').split(','); - if (this.group) { let filteredGroups = []; for (let optgroup of this.options as any[]) { - let filteredSubOptions = this.filterService.filter(this.getOptionGroupChildren(optgroup), searchFields, this.filterValue, this.filterMatchMode, this.filterLocale); + let filteredSubOptions = this.filterService.filter(this.getOptionGroupChildren(optgroup), this.searchFields(), this.filterValue, this.filterMatchMode, this.filterLocale); if (filteredSubOptions && filteredSubOptions.length) { filteredGroups.push({ ...optgroup, ...{ [this.optionGroupChildren]: filteredSubOptions } }); } @@ -2065,7 +2063,7 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft this._filteredOptions = filteredGroups; } else { - this._filteredOptions = this.filterService.filter(this.options as any[], searchFields, this._filterValue, this.filterMatchMode, this.filterLocale); + this._filteredOptions = this.filterService.filter(this.options as any[], this.searchFields(), this.filterValue, this.filterMatchMode, this.filterLocale); } } else { this._filteredOptions = null;