Load initial table with filter applied
Load initial table with filter applied
Hello,
Thanks for taking time to read my post. My first time using the extension and I'm stuck. I want the datatable to load with a filter/search applied. I've searched and tried many of the implementations but I always receive a full data set. I'm able to apply filters with "onclick" events but not able to set a default.
<
script type="text/javascript">
window.onload = function defer()
{
if(window.$)
{
var table = $('#tbl').DataTable({
//"aoSearchCols": [{ "sSearch": "^[0-9]", "bEscapeRegex": false }],
"retrieve": true,
"paging": false,
"ordering": false,
"info": false,
"search": false,
"fnInitComplete": function (oSettings, json) {
alert('DataTables has finished its initialisation.')
}
});
}
else
{
setTimeout(defer(), 50);
}
}
function fil(rexp)
{
var table = $('#tbl').DataTable({
"retrieve": true,
"paging": false,
"ordering": false,
"info": false,
"search": false
});
table
.columns(0)
.search(rexp, true,false,true)
.draw()
}
Answers
Any help would be appreciated - not having any luck.
Thanks,
Mike
I think fnFilter is as close as you're gonna get. It does fire after initialization, however.
https://datatables.net/api#fnFilter