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 }