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 #3375: Dropdown allow filtering of primitive strings #3380

Merged
merged 1 commit into from
Sep 28, 2022
Merged
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
17 changes: 13 additions & 4 deletions components/lib/api/FilterService.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ export 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);
Expand Down