1

I'm trying to get all tables (which are dataTables) on a page,

CODE:

$(window).load(function(){
    if($.fn.dataTable)
    {
        var tables = $.fn.dataTable.fnTables();
    }
});

Getting the following error,

has no method 'fnTables'

$.fn.dataTable is defined and no errors there, so, I searched for fnTables in the jquery.dataTables.js file and I couldn't find it.

But, .fnTables() is THE way to do what I want as per the datatables site.

What can I do?

DataTable version is 1.9.0

4

2 回答 2

1

我猜问题是没有fnTables()方法是dataTables 1.9.0。

我刚刚下载并查看了新文件(1.9.4),它有方法.fnTables()

可惜,虽然网站上没有记录。

于 2013-06-27T06:50:46.407 回答
0

你有没有先初始化表格?

$('#ss_list').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "sDom": '<"H"lTfr>t<"F"ip>'.
    // ...
});

var table = $.fn.dataTable.fnTables(true);
if ( table.length > 0 ) {
    alert('You had created a dataTable!');
}
于 2013-06-27T06:51:36.887 回答