From 66eb291ff55291a007feda50507c35491371aa82 Mon Sep 17 00:00:00 2001 From: Kouts Date: Sat, 8 Jan 2022 12:51:55 +0200 Subject: [PATCH] fix: pass rowData as 3rd param to the searchAs function --- src/helpers/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helpers/index.js b/src/helpers/index.js index 5998feb..ede2870 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -116,19 +116,19 @@ function fieldFilter(items, filterFields) { } // Search method that also takes into account transformations needed -function findAny(dsSearchIn, dsSearchAs, obj, str) { +function findAny(dsSearchIn, dsSearchAs, rowData, str) { // Convert the search string to lower case str = String(str).toLowerCase() - for (const key in obj) { + for (const key in rowData) { if (dsSearchIn.length === 0 || dsSearchIn.indexOf(key) !== -1) { - const value = String(obj[key]).toLowerCase() + const value = String(rowData[key]).toLowerCase() for (const field in dsSearchAs) { if (field === key) { // Found key in dsSearchAs so we pass the value and the search string to a search function // that returns true/false and we return that if true. /* Check if dsSearchAs is a function (passed from the template) */ if (typeof dsSearchAs[field] === 'function') { - const res = dsSearchAs[field](value, str) + const res = dsSearchAs[field](value, str, rowData) if (res === true) { return res }