The "yadcf" plugin does not work with datatables

I am trying to use the filtering plugin "yadcf" with datatables and getting "Uncaught TypeError: undefined is not a function" like the error in which the yadcf function is called.

I checked that the plugin is loaded, I'm not sure what the problem is.

Here are the downloadable libraries:

<script type="text/javascript" charset="utf-8" src="/DataTables/media/js/jquery-1.10.2.js"></script>
<script type="text/javascript" charset="utf-8" src="/DataTables/jquery-ui-1.10.3/ui/jquery-ui.js"></script>

<script type="text/javascript" charset="utf-8" src="/DataTables-1.10.0/media/js/nightly2.js"></script>
<script type="text/javascript" charset="utf-8" src="/yadcf-0.7.4/jquery.dataTables.yadcf.js"></script>

Css files:

<style type="text/css" title="currentStyle">
    @import "/DataTables/media/css/demo_table.css";
    @import "/yadcf-0.7.4/jquery.dataTables.yadcf.css";
    @import "/DataTables/examples/examples_support/themes/ui-lightness/jquery-ui-1.8.4.custom.css";

</style>

Data type:

oTable = $('#FE_Time_Table').DataTable( {
   "ajax":{"url": 'FE_Data.php', "dataSrc":'data'},
   "jQueryUI": true,  //Allow use of jquery-ui plug-in for themes
   "dom": 'W<"H"frCi>tS<"">', //Settings for where all the options appear on the page

   "columns": [
        { "name": "plate_no", "data": "plate_no", "className": "center_text" },
        { "name": "job_no", "data": "job_no", "className": "center_text" },
        { "name": "customer", "data": "customer" },
        { "name": "device", "data": "device" },
              ]

   }).yadcf([{column_number : 0}]);
+4
source share
1 answer

You need to use the latest version of yadcf 0.8.2, grab it from github repo

Then you should use the new init yadcf function like

var Table = $('#FE_Time_Table').DataTable(...);
yadcf.init(Table , [{column_number : 0}]);

you can see this new init function that is used on showcase


ps I am the author of yadcf

+10
source

Source: https://habr.com/ru/post/1546936/


All Articles