table.row不是函数 [英] table.row is not a function

查看:99
本文介绍了table.row不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在数据表中实现行详细信息,就像小提琴,它会产生此错误.

据我了解,未找到我的数据表的row()函数.但是我不明白……我使用的是最新的数据表版本和jquery版本1.11.1(而不是小提琴中显示的1.11.0),这也是示例中使用的(在datatables网站上).

我被困住了……有人知道为什么我会收到此错误吗?

非常感谢

解决方案

我不知道dataTableDataTable函数之间的区别是什么,但是当我使用第二个函数初始化数据表时,您的代码起作用了

 oTable = $('#tblCasesMain').DataTable({ ...

这是小提琴,它只会在未定义的format函数上产生错误.

注意:我已根据此示例更改了该函数名称.

更新: 我做了一些研究并得到了答案.看看升级说明 此处,其中包含以下内容:

如果要从DataTables 1.9或更早版本升级,您可能会注意到此处使用大写D来初始化DataTable. $().DataTable()返回一个 DataTables API实例 ,而 $().dataTable()也将初始化一个DataTable,但返回一个 jQuery对象.

I am trying to implement row details in my datatables just like this example.

When I click on the show more image of my table, I get an error in my firebug console saying:

TypeError: oTable.row is not a function
var row = oTable.row(tr);

Here is also a fiddle of my code that generates this error.

As i understand it, the row() function of my datatables is not found. But i don't get it... I use the latest datatables version with jquery version 1.11.1 (and not 1.11.0 as shown in fiddle) which is what is used in the example also(on datatables website).

I am stuck... Anyone has any idea why I get this error?

Thanks a lot

解决方案

I don't know what is the difference between dataTable and DataTable functions, but your code worked when I initialized the data table using the second function.

 oTable = $('#tblCasesMain').DataTable({ ...

Here is the fiddle, which only gives an error on format function which is not defined.

Note: I have changed that function name as per this example.

Update: I have done a bit of research and got the answer. Take a look at the Upgrade note here which says the following:

If you are upgrading from DataTables 1.9 or earlier, you might notice that a capital D is used to initialise the DataTable here. $().DataTable() returns a DataTables API instance, while $().dataTable() will also initialise a DataTable, but returns a jQuery object.

这篇关于table.row不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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