Yadcf: oTable.settings is not a function for init

I haven't found a working example where table data is loaded via javascript and I get oTable.settings - it's not a function error when trying to initialize filters. DT is loading properly. We appreciate any suggestions.

Thanks, Rick

Here is my code:

<script src="../bower_components/jquery/jquery.js" type="text/javascript"></script>
<script src="../lib/DataTables-1.10.5/media/js/jquery.dataTables.js" type="text/javascript"></script>
<script src="../lib/yadcf-0.8.8/jquery.dataTables.yadcf.js" type="text/javascript"></script>

      

...

<script type="text/javascript" charset="utf-8">
var ndx=0;
$(document).ready( function () {
    var myTable = $('#example').dataTable({
        "data": data.tables[ndx].data,
        "columns": data.tables[ndx].columns,
        "uHeaders": [],
        "uMeta": []
    });
    yadcf.init(myTable, [
    {column_number : 0},
    {column_number : 1, filter_type: "text"}
    ]);
});

      

+3


source to share


1 answer


You should use the yadcf function init

whenever you only use the new d datatables capital constructor.

When using the datatables inline constructor, you must use the old yadcf api, $('#example').dataTable({...}).yadcf(...);

So either change $('#example').dataTable({

to$('#example').dataTable({



or

Instead of calling, yadcf.init(...

use

var myTable = $('#example').dataTable({
    "data": data.tables[ndx].data,
    "columns": data.tables[ndx].columns,
    "uHeaders": [],
    "uMeta": []
}).yadcf(...)

      

+5


source







All Articles