Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #17398 MultiSelect filtering not working with class instances #17399

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/primeng/src/multiselect/multiselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ export class MultiSelect extends BaseComponent implements OnInit, AfterViewInit,

visibleOptions = computed(() => {
const options = this.getAllVisibleAndNonVisibleOptions();
const isArrayOfObjects = isArray(options) && isObject(options[0]);
const isArrayOfObjects = isArray(options) && this._isObject(options[0]);

if (this._filterValue()) {
let filteredOptions;
Expand Down Expand Up @@ -2306,6 +2306,10 @@ export class MultiSelect extends BaseComponent implements OnInit, AfterViewInit,
hasFilter() {
return this._filterValue() && this._filterValue().trim().length > 0;
}

private _isObject(value, empty = true) {
return typeof value === 'object' && !Array.isArray(value) && value != null && (empty || Object.keys(value).length !== 0);
}
}

@NgModule({
Expand Down