From c99ef1f803d95973167eea8d3129dd6961d6e39b Mon Sep 17 00:00:00 2001 From: Guillaume Louis Date: Mon, 18 Sep 2023 13:02:49 +0200 Subject: [PATCH] issue primefaces#4071 fix --- components/lib/api/FilterService.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/lib/api/FilterService.js b/components/lib/api/FilterService.js index 8185a41f43..ab02b67093 100644 --- a/components/lib/api/FilterService.js +++ b/components/lib/api/FilterService.js @@ -4,10 +4,19 @@ const FilterService = { filter(value, fields, filterValue, filterMatchMode, filterLocale) { let filteredItems = []; - if (value) { - for (let item of value) { - for (let field of fields) { - let fieldValue = ObjectUtils.resolveFieldData(item, field); + if (!value) { + return filteredItems; + } + + for (const item of value) { + if (typeof item === 'string') { + if (this.filters[filterMatchMode](item, filterValue, filterLocale)) { + filteredItems.push(item); + continue; + } + } else { + for (const field of fields) { + const fieldValue = ObjectUtils.resolveFieldData(item, field); if (this.filters[filterMatchMode](fieldValue, filterValue, filterLocale)) { filteredItems.push(item);