Column filtering with hidden field returns search for wrong column
Column filtering with hidden field returns search for wrong column

See example.
You will notice that the first field, "name", is not visible. If you search on the "office" field, it will return the search results instead for the "position" field.
BTW, the reason why it is hidden is that I want to make it a default for the clovis extension to dynamically hide columns. I just wanted to default this row to be not visible, and people can unhide it if desired. I left clovis out, since the problem appears with and without it.
This question has an accepted answers - jump to answer
Answers
The reason for this is that when you initialise the table with the hidden column you are removing one of the columns from the display, so the index in the DOM no longer matches the data index for the columns (i.e. consider that "Position" is now display index 0, but still data index 1). So using the DOM index for
column()
isn't going to work.Not to worry though, we've already thought of that
. The
column-selector
can be told to work on visible or data indexes - e.g.:Updated example.
Allan
Fantastic!
Datatables is simple, yet can get complex as you tailor it, which should be expected. It seems that you have worked out most of the issues which indicates a reasonably mature product.
When possible, its definitely worth the time to drill down a problem to the smallest scope possible, and post a link from the live site. Solutions are usually pretty quick then.