A separate (but related) question: why would this

dansmith65:
A separate (but related) question: why would this custom filter work:

"callback_calcf": "arguments[0].address.includes(arguments[1])"

But this one seems to be ignored?

"callback_calcf": "true"

Hassan Mukhtar:
In the first example you have a callback function whereas the second example is a string literal if you wanted the callback to always be ‘true’ you would need to do something like "callback_calcf": "() => true"


dansmith65:
Considering how it’s compiled into an anonymous function, and called by the component (attached); it seems to me like a string literal should work the same as a function.

More importantly, that doesn’t change the default behavior of the filter, either. I thought the point of a custom filter was to return true or false to either include or exclude the row, but when using a simple example like this, it doesn’t seem to work.

image

image


dansmith65:
Interestingly, "callback_calcf": "false" does work as expected (always matching no records).

After more digging in the code, I’ve found that Custom Filters are run first, then the default filter is run on whatever data the Custom Filter returns… which is why true works the same as the default filter.

Looks like what I really want is: https://matanya.gitbook.io/vue-tables-2/client-table/filtering-algorithm


dansmith65:
…and it works! Here’s how to add a filter for a column named “address”:

"filterAlgorithm": {
	"address_calcf": "arguments[0].address.includes(arguments[1])"
}