Skip to content

Commit

Permalink
Merge pull request #14220 from vinnyab28/14194-pmultiselect-filter-wi…
Browse files Browse the repository at this point in the history
…th-default-label

14194: Fixed filter with default 'label' field
  • Loading branch information
cetincakiroglu committed Dec 6, 2023
2 parents 5216781 + d6c3eae commit c335de9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/components/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -2056,20 +2056,18 @@ 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 } });
}
}

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;
Expand Down

1 comment on commit c335de9

@vercel
Copy link

@vercel vercel bot commented on c335de9 Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment failed with the following error:

The value for maxDuration must be between 1 second and 10 seconds, in order to increase this limit upgrade your plan: https://vercel.com/pricing

Please sign in to comment.