获取错误 - TypeError:DataTable.fnDestroy不是一个函数 [英] Getting error - TypeError: DataTable.fnDestroy is not a function

查看:2659
本文介绍了获取错误 - TypeError:DataTable.fnDestroy不是一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下使用数据表的代码

I have following code that is using data table

Contact.dataTable = $('#table').dataTable( {
.............
},
 $('#table tbody').on('click', '.position', function () {
            var row = this.parentElement;
             var data = Contact.dataTable.row(row).data();
...
}

由于上述代码发生错误TypeError:Contact.dataTable.row不是函数 / code>,我已将每个 dataTable 更改为 DataTable ,但现在它给出错误TypeError:Contact.DataTable.fnDestroy不是一个函数

Since above code was giving error "TypeError: Contact.dataTable.row is not a function", I have changed every dataTable to DataTable. But now it gives error "TypeError: Contact.DataTable.fnDestroy is not a function".

以下是错误的代码

Contact.DataTable = $('#table').DataTable( {
    .............
    },
     $('#table tbody').on('click', '.position', function () {
                var row = this.parentElement;
                 var data = Contact.DataTable.row(row).data();
    ...
    }

if('DataTable' in Contact) {
            Contact.DataTable.fnDestroy();
}

任何人请帮助!

推荐答案

似乎是区别...

_table = jQuery('table#fp-table-table ').dataTable(); // .fnDestroy()工作

_table = jQuery('table#fp-table-table').dataTable(); // .fnDestroy() works and

_table = jQuery('table#fp-table-table')DataTable(); // .fnDestroy()不工作
DataTable似乎是用于API调用回到对象,dataTable似乎是初始化方法。

_table = jQuery('table#fp-table-table').DataTable(); // .fnDestroy() doesn't work DataTable seems to be for API calls back into the object and dataTable seems to be the intialisation method.

我的项目我已经将初始化更改为使用DataTable而不是dataTable执行过滤任务。之后,我的AJAX重新加载将抛出'未定义'错误,所以我改回它...我esta。

In my project I had changed the initialisation to use DataTable instead of dataTable to perform a filtering task. After this my AJAX reloads would throw the 'undefined' error, so I changed it back... i esta.

这篇关于获取错误 - TypeError:DataTable.fnDestroy不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆