column.search() no matching records found
column.search() no matching records found

Hi everyone,
i'm using datatables to display an ajax dataset and using individual column search with integer values.
This is the snippet :
jQuery('.footer-selectors').on( 'change', function () {
index = jQuery(this).data('index');
var val = $.fn.dataTable.util.escapeRegex($(this).val());
console.log("Searching " + val + " in column "+ index);
console.log(datatable.column(3).data().unique().sort());
datatable.column(index).search(val ? '^'+val+'$' : '',true,false).draw();
} );
.footer-selectors are select boxes with values ranging from 1-12).
Whenever i change it however, i get 'no matching records found'.
Whereas my column.data() is as follows:
_Api(11) ["", "1", "11", "12", "2", "3", "4", "5", "6", "7", null, context: Array(1), selector: {…}, tables: ƒ, table: ƒ, draw: ƒ, …]
And console.log gives me :
Searching 2 in column 3
Are there specifics when searching such short input values?
I have tried enabling regex search, smart search to no avail.
Answers
Your statement
datatable.column(index).search(val ? '^'+val+'$' : '',true,false).draw();
works here:http://live.datatables.net/gubujoya/1/edit
Please provide a link to your page or a test case (update mine if you wish) replicating the issue so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
The datatable.column(3).data() log is :
_Api(729) [null, "2", "1", "2", "12", "1", null, null, "4", "5", "5", "12", "4", null, null, "3", null, null, null, "4", "3", null, "4", null, null, "1", "4", "5", "12", "1", null, "1", "2", "12", null, "3", null, "4", "3", null, "5", "1", "12", null, null, "1", "2", "7", null, null, null, null, "2", "1", "3", null, null, "3", null, "3", "4", "12", null, "1", "12", null, null, "12", "1", null, "3", "2", null, "3", null, "5", "2", null, "3", "1", "7", "3", null, "2", "12", "2", "3", "4", "12", "2", "12", "5", null, "3", "5", null, "5", null, null, "5", …]
There are a lot of null values if that matters for the search procedure.
Works here with
null
data. Please provide a test case so we can help.http://live.datatables.net/giwireku/1/edit
Kevin