Custom filtering doesn't work with 0
Custom filtering doesn't work with 0
Floriane
Posts: 22Questions: 6Answers: 0
Hi,
I am integrating filters on my dataTable. On your exemple here : http://datatables.net/examples/plug-ins/range_filtering.html
When you insert "0" on "Maximum age:", filter doesn't work. Do you know this bug ?
Thank you,
Floriane.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What do you mean by " filter doesn't work"? It seems to me that "0" is just ignored, which is the behaviour I would expect.
Yes, but if I want to search a value equals to 0 I can't, is it right ?
Why 0 is ignored ? Where can I change this behaviour ?
I can't find where this behavior is in DataTable.js ... Does someone can help me please?
You are looking at a range filter. It finds values between x and y. For values equal to x, use a different filter.
I use the range filter and an equal filter. None of them works with value "0"... Like you said, the "0" is ignored.
Nobody knows where I can find this behavior ?
What do you mean by "an equal filter"? It would make more sense to show us your code so we can see what you are doing.
Its a bug in the example rather than in DataTables. The filter does run, but the data isn't being correctly filtered out.
If you update the custom filter to the following code it does work:
I'll update the example for 1.10.1.
Thanks,
Allan
Ok, everything works fine.
Thanks Allan !