使用Cordova应用程序重新加载DataTable会导致javascript崩溃

时间:2014-12-03 14:13:02

标签: jquery cordova datatables

我正在使用jQuery DataTables并且它们在所有浏览器上都能正常工作,除非我将我的webapp嵌入到Cordova的本机应用程序中。

当我尝试使用不同的数据对表进行实现时会产生问题。这发生在用户按下按钮上。代码如下:

var table = $('#table_container').DataTable();
if (table != null) {
   table.destroy(); //Crash here!
}

崩溃发生在destroy调用上,但是我已经用DT的任何其他有效调用替换了这个函数,结果是相同的。我之前用这种方式初始化了DataTable:

var table = $('#table_container').DataTable({
            "pageLength": 100,
            "ordering": false,
            "lengthChange": false,
            "info": false,
            "language": {
                "url": "//cdn.datatables.net/plug-ins/a5734b29083/i18n/Italian.json"
            },
            "initComplete": function () {
            var api = this.api();
             if(api.data().length <= 100){
                  $('#table_container_paginate').hide();
                  $('#table_container_filter').hide();
              }
            }
        });

0 个答案:

没有答案