Custom filtering not working. Uncaught TypeError: Cannot read property 'push' of undefined error
Custom filtering not working. Uncaught TypeError: Cannot read property 'push' of undefined error

I am trying to apply custom filtering to a table. But I am getting nothing, and I am getting 'Uncaught TypeError: Cannot read property 'push' of undefined' error in console.
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
return (aData[0] == 'Alina Acharya') ? true : false;
}
);
var table = $('#checkin-checkout-record-table').dataTable({
"bPaginate": true,
"bLengthChange": true,
"bFilter": true,
"bSort": true,
"bInfo": true,
// "order": [[0, 'asc'], [4, 'asc']],
"aLengthMenu": [50, 100],
"bAutoWidth": false
});
table.draw();
What is wrong? I am using 1.10.0-dev version.
This discussion has been closed.
Answers
Maybe try the newer version $.fn.dataTable.ext.search.push.
Hope it works with your older data tables version. Here is an example from my own coding filtering multiple tables on one page. Data tables runs through this for every table on the page. Hence I need to check the rows passed in for "undefined" to identify the table and apply the respective filter.
Ouch. Why?
.
1.10.16 is the current release. I'd suggest you update.
Allan
thanks for the answer... I am beginning to make some progress now..
But the function is returning false and filtering all rows, despite of rows with 'Rakesh Mali' being present.
This is working fine with [http://jsfiddle.net/1hLcpr3x/132/].
What is the problem, please help.
Sorry, your jsfiddle produces a 404 error and I have no experience with the outdated data tables version you are using. Cannot help you.
The 404 is because the forum is including the
].
in the link.I don't see
Rakesh Mali
in the data set at all, but the fiddle appears to be working properly as you state. We'd need to actually be able to see it not working to offer any help rather than seeing it working!If you are still using an old version of DataTables, update it. Very likely the dev version you are using didn't include all the features.
Allan