HTML5 data-search attribute not working
HTML5 data-search attribute not working
Hi,
I'm trying to use the HTML5 data-search attribute on a table, and it doesn't seem to be working. I have the newest version of datatables and have successfully used data-order elsewhere on the same website which works correctly.
I have a table with 2 rows, and the following is the contents of the first cells in each row:
<td data-search="10" class=" nowrap center"><i style="color:#CF000F" class="fa fa-circle"></i></td>
<td data-search="0" class=" nowrap center"><i class="fa fa-circle"></i></td>
I then apply table.column(0).search('10'), and can see this has correctly applied by running table.column(0).search() and having "10" returned to me. When I then call table.draw(), I get no data.
Even if I try using the filter for every cell, searching 10 returns no results.
What could I be doing wrong?
Thanks.
This question has an accepted answers - jump to answer
Answers
I built a test case for you with your two rows and searches. Copied the two column 0 values directly from the above code.. Looks like it works:
http://live.datatables.net/reruqeha/1/edit
I get one row returned. Here is the code:
Maybe you can update the test case to show the problem you are having.
Kevin
Thanks a lot Kevin
I pasted in my table and datatables initialisation into that and found it stopped working, so removed things until it did. Turns out my columns initialisation option was bad as I was incorrectly using columns.data for a simple identifier of the column, when I probably should have been using columns.name.
Thanks again!