Skip to content

Commit a612c80

Browse files
authored
Update mixin-filtering.js
1 parent 470212e commit a612c80

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/components/table/helpers/mixin-filtering.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,14 @@ export default {
257257
defaultFilterFnFactory(criteria) {
258258
// Generates the default filter function, using the given filter criteria
259259
// Returns `null` if no criteria or criteria format not supported
260+
261+
// Grab some values ahead of time (to trigger reactive changes)
262+
const filterIgnored = this.computedFilterIgnored
263+
const filterIncluded = this.computedFilterIncluded
264+
const fieldsObj = this.computedFieldsObj
265+
266+
// Built in filter can only support strings or RegExp criteria (at the moment)
260267
if (!criteria || !(isString(criteria) || isRegExp(criteria))) {
261-
// Built in filter can only support strings or RegExp criteria (at the moment)
262268
return null
263269
}
264270

@@ -274,11 +280,6 @@ export default {
274280
regExp = new RegExp(`.*${pattern}.*`, 'i')
275281
}
276282

277-
// Grab some values ahead of time
278-
const filterIgnored = this.computedFilterIgnored
279-
const filterIncluded = this.computedFilterIncluded
280-
const fieldsObj = this.computedFieldsObj
281-
282283
// Generate the wrapped filter test function to use
283284
const fn = item => {
284285
// This searches all row values (and sub property values) in the entire (excluding
@@ -295,14 +296,7 @@ export default {
295296
//
296297
// We set `lastIndex = 0` on the `RegExp` in case someone specifies the `/g` global flag
297298
regExp.lastIndex = 0
298-
return regExp.test(
299-
stringifyRecordValues(
300-
item,
301-
filterIgnored,
302-
filterIncluded,
303-
fieldsObj
304-
)
305-
)
299+
return regExp.test(stringifyRecordValues(item, filterIgnored, filterIncluded, fieldsObj))
306300
}
307301

308302
// Return the generated function

0 commit comments

Comments
 (0)