插件“yadcf”无法使用数据表

时间:2014-07-02 23:30:47

标签: datatables yadcf

我试图使用" yadcf"使用数据表过滤插件并获取" Uncaught TypeError:undefined不是函数"作为调用yadcf函数的错误。

我已经确认插件已加载,我不确定问题是什么。

以下是正在加载的库:

<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文件:

<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>

数据表:

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}]);

1 个答案:

答案 0 :(得分:10)

您需要使用最新的yadcf版本0.8.2,从github repo

抓取它

然后你应该使用yadcf的新init函数,就像这个

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

您可以在showcase

上看到这个新的初始化函数

p.s我是yadcf的作者

相关问题