Skip to content

Commit

Permalink
Fixed #8348 - FilterUtils.filter only accepts filterValue of type string
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Nov 30, 2020
1 parent a53c53e commit a10bc51
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/app/components/api/filterservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ import { ObjectUtils } from '../utils/objectutils';
@Injectable({providedIn: 'root'})
export class FilterService {

filter(value: any[], fields: any[], filterValue: string, filterMatchMode: string, filterLocale?: string) {
filter(value: any[], fields: any[], filterValue: any, filterMatchMode: string, filterLocale?: string) {
let filteredItems: any[] = [];
let filterText = ObjectUtils.removeAccents(filterValue).toLocaleLowerCase(filterLocale);

if (value) {
for (let item of value) {
for (let field of fields) {
let fieldValue = ObjectUtils.removeAccents(String(ObjectUtils.resolveFieldData(item, field))).toLocaleLowerCase(filterLocale);
let fieldValue = ObjectUtils.resolveFieldData(item, field);

if (this.filters[filterMatchMode](fieldValue, filterText, filterLocale)) {
if (this.filters[filterMatchMode](fieldValue, filterValue, filterLocale)) {
filteredItems.push(item);
break;
}
Expand Down

0 comments on commit a10bc51

Please sign in to comment.