Column Filtering Issue
Column Filtering Issue

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
I am upgrading from 1.10 to 2.3.2 and when I was testing one page that had column filtering, I noticed as soon as I typed a character in the text box, I got an error: "ReferenceError: visible is not defined"., in dataTables.min.js.
When I looked at js file, I noticed error occurred at:
if (o)
switch (o[2]) {
case "visIdx":
case visible:
return o[1] && o[1].match(....)
When I added quotes to visible, error went away.
I reverted the change because I am not 100% sure this is the issue and didn't want to mess with datatable's js file.
Also, I noticed when I click on filter text box, table gets sorted, as if I had clicked on column header itself. Is there a way of preventing this, or because filter is part of header, it just sorts it automatically?
Answers
I've just had a look at the 2.3.2 min file for that part of the code and it has the
visible
in quotes:Happy to take a look at a test case of the issue showing the problem.
Allan
Thank you. I checked the version in CDN and it also has quotes. Not sure how my version ended up like this. I updated the file again and it's fine now.
How about the second question about table getting sorted as soon as I put the cursor in column filter textbox?
I tried:
Still sorts table.
If you could link to a test case showing the issue, that would help me debug it. I would have expected the above to work.
You could put the input element into a different row in the header - e.g: like this.
Another option is to disable the default sort listener and use a button instead.
Allan
orcderCellsTop seems to fix the issue.
On the site, https://datatables.net/reference/option/orderCellsTop, it says it is deprectaed and alternatives discussed below should be used, but looks like "below" still shows how to use orderCellsTop.
Use
titleRow
. Thanks for pointing out that error - I'll fix that just now.Allan