Empty yadcf settings array
Closed this issue · 5 comments
I'd like to have the ability to give empty settings array object to the plugin so yacdf is not active even though it's applied to the datatable, like this:
var myDataTable= $('table').dataTable({
}).yadcf( [ ]);
Because I'm providing dynamic options array based on a set of conditions and there's a case where no yadcf filter should appear at all. I'm currently tricking it by providing out of bound col number:
yadcfColumnsOptions = [{
column_number: 500
}
But this causes a js error in the plugin.
Thanks,
@ayyadalaa when no need on yadcf on your page why can't you skip yadcf init code at all?
I meant that you can call yadcf init only when its needed
if (ydcfFiltersNeeded) {
yadcf.init(myDataTable, yadcfColumnsOptions);
}
Got it, thanks for your reply. I think this issue can be cancelled as invalid.
Worked well, just a note for whoever reading this thread:
Make sure to instantiate your datatable with capital D (as stated on yacdf site) like this:
var myDataTable= $('table').DataTable({
//your datatable options
});
Thanks again!