$.fn.dataTable.ext.search.push() and Repopulating Original Data
$.fn.dataTable.ext.search.push() and Repopulating Original Data
Hi all,
I've been able to run $.fn.dataTable.ext.search.push() without any issues and everything works great. I'm trying to reverse the process by using a set of chained methods but to no luck.
Here's what I have so far:
table = $('#example').DataTable({
"scrollY": "1000 px",
"scrollX": true,
"scrollCollapse": false,
"paging": true,
"searching": true
} );
--To search (filter) the results---
function DataTableSearch(low, high, $colnum) {
$.fn.dataTable.ext.search.push(
function (settings, data, dataIndex) {
var $fcolnum = parseFloat(data[$colnum].replace(/\s|-(\D)|[^-0-9]/g, "")) || 0;
if ((isNaN(low) && isNaN(high)) ||
(isNaN(low) && $fcolnum < high) ||
(low < $fcolnum && isNaN(high)) ||
(low < $fcolnum && $fcolnum < high)) {
return true;
}
return false;
}
)
}
and to revert back to the original data. I'm using:
table.search('').columns().search('').draw();
Am I right that table.search('').columns().search('').draw(); should work?
Any suggestions?