【问题标题】:plugin "yadcf" not working with datatables插件“yadcf”不适用于数据表
【发布时间】:2014-08-23 22:16:03
【问题描述】:

我正在尝试将“yadcf”过滤插件与数据表一起使用,并在调用 yadcf 函数时将“Uncaught TypeError: undefined is not a function”作为错误。

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

这里是正在加载的库:

<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.10.x,据我所知,yadcf 不支持 1.10.x,但 (!!) -> datatables.net/forums/discussion/15016/…
  • 我试过使用 1.10.0,这是最后一个版本。还是不行,不过yadcf官网说支持
  • 以前版本的 yadcf 确实支持 1.10.0 但不支持新的数据表 API(大写“D”),无论如何最新的 yadcf 也支持新的 API

标签: datatables yadcf


【解决方案1】:

你需要使用最新的 yadcf 版本 0.8.2 ,从github repo获取它

那你应该使用yadcf新的init函数,像这样

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

你可以在showcase上看到这个新的初始化函数


p.s 我是 yadcf 的作者

【讨论】:

  • 更新,昨天发布了yadcf 0.8.2,支持:新的Datatable API - 使用yadcf.init(...) / Select2 / ColVis
  • @Daniel 请更新您的文档。这让我想了 30 分钟。这些文档已过时。 yadcf-showcase.appspot.com/DOM_source.html
  • @SpoiledTechie.com ,我将无法在不久的将来这样做,但由于展示是公开的 github.com/vedmack/yadcf-showcase 随时发送 PR
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多