Skip to content

Commit ec3a81a

Browse files
authored
feat: pass rowData as 3rd param to the searchAs function
1 parent 1f8c91c commit ec3a81a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/helpers/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,19 @@ function fieldFilter(items, filterFields) {
116116
}
117117

118118
// Search method that also takes into account transformations needed
119-
function findAny(dsSearchIn, dsSearchAs, obj, str) {
119+
function findAny(dsSearchIn, dsSearchAs, rowData, str) {
120120
// Convert the search string to lower case
121121
str = String(str).toLowerCase()
122-
for (const key in obj) {
122+
for (const key in rowData) {
123123
if (dsSearchIn.length === 0 || dsSearchIn.indexOf(key) !== -1) {
124-
const value = String(obj[key]).toLowerCase()
124+
const value = String(rowData[key]).toLowerCase()
125125
for (const field in dsSearchAs) {
126126
if (field === key) {
127127
// Found key in dsSearchAs so we pass the value and the search string to a search function
128128
// that returns true/false and we return that if true.
129129
/* Check if dsSearchAs is a function (passed from the template) */
130130
if (typeof dsSearchAs[field] === 'function') {
131-
const res = dsSearchAs[field](value, str)
131+
const res = dsSearchAs[field](value, str, rowData)
132132
if (res === true) {
133133
return res
134134
}

0 commit comments

Comments
 (0)