Closed Smith-Chris1 closed 9 months ago
Thx for your question
There's a possibility, indeed. You can create a custom check function like this:
const customCheck = (entry, value) => {
entry.indexOf(value) === -1
}
// Then pass it to the filter method as an argument:
handler.filter('value', 'columnName', customCheck)
But I'm going to add this inverse filter natively.
contains
will become isLike
+ will add isNotLike
I remain open to all suggestions if idiomatic comparators like this are missing. I keep you in touch.
As always, you're the best!
For now - I've added this:
Comparator.d.ts:check
isNot: (entry: any, value: any) => boolean;
Comparator.js:check
isNot: (entry, value) => { return entry.indexOf(value) === -1 },
I know I can do a custom one, but in an effort to look smart and keep similar functions together, that's what I've done.
Yes I understand. Glad you found the location in the source code btw.
For my part I've just published isNotLike
in 1.12.7
So you'll find isNotLike
and isNotEqualTo
in addition.
Examples in the doc:
https://vincjo.fr/datatables/advanced-filters/comparators
Note: contains
has been deprecated only, and there's no plan to remove it
Ok - time for another dumb question.
Lets say I have defined a filter, using
contains
BUT what if I want the inverse of that, something likenotContains
or!contains
.I'm sure its possible, but I can't seem to figure out how to do that.