$.fn.dataTable.ext.search.push is not called
$.fn.dataTable.ext.search.push is not called
NehaC
Posts: 20Questions: 5Answers: 0
below I mention the code -
$(document).ready(function() {
var table = $('#ooma-softwares-table').DataTable();
$.fn.dataTable.ext.search.push(
function( settings, searchData, index, rowData, counter ) {
console.log("in func");
// Loop through all columns and get the checkbox state and input value
for (i=0; i<searchData.length; i++) {
var checked = $('#not_equal_' + i).prop('checked');
console.log( "&&&&& = "+i)
// hide row if checked and input matches cell
if (checked && $('#text_box'+i).val() === searchData[i]) {
return false;
}
}
return true;
}
);
});
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
It seems to be getting called here: http://live.datatables.net/wucuxizu/1/edit . I've commented out the logic, since the table data doesn't match - but the log message is displayed.
Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.
Cheers,
Colin
Hello Colin,
In my code, I use CoffeeScript and I use processing & serverside true so maybe because of this, that function is not called?
$('#example').DataTable( {
"processing": true,
"serverSide": true,
} );
In this example I use javascript and it throws an error.
http://live.datatables.net/qunodalu/3/edit
Yep, that's exactly it. With
serverSide
all searchng/ordering/paging is performed on the server, so the client-side search will have no effect. You may not needserverSide
if you have less that 10-20k rows,Colin
Hello Colin,
My rows are more than 6000 and If I remove this option then it only shows 10 rows serverSide: true
Now, what should I do?
With
serverSide
, only the rows required for that page are returned. It might be the case that your server-side script isn't complying with the client's request. The protocol is discussed here. Also see examples here.Cheers,
Colin