DataTable的jQuery插件不起作用。 fnGetColumnData

时间:2021-09-18 14:29:12

I added plugin

我添加了插件

$.fn.dataTableExt.oApi.fnGetColumnData

Can be found here: http://datatables.net/plug-ins/api

可以在这里找到:http://datatables.net/plug-ins/api

After I executed

我执行后

$(document).ready(function () { 
var oDataTable = $("#usersGrid").dataTable();
//... 
} 

Microsoft JScript runtime error: Unable to get value of the property 'asSorting': object is null or undefined.

Microsoft JScript运行时错误:无法获取属性'asSorting'的值:object为null或undefined。

What can be a reason? P.S.: It's not fnGetColumnData problem but another one which connected with $("#usersGrid").dataTable();

可能是什么原因? P.S。:这不是fnGetColumnData问题,而是另一个与$(“#usersGrid”)连接的问题.dataTable();

$('#example').dataTable({
            "sDom": 'R<"H"lfr>t<"F"ip<',
            "bJQueryUI": true,
            "bFilter": true,
            "sPaginationType": "full_numbers",
            "aoColumns": [
                { "sTitle": "A" },
                { "sTitle": "B" },
                { "sTitle": "C" }
            ]
        });

2 个解决方案

#1


6  

I think that this has something to do with your markup. Remember that dataTables needs an html table with <thead> section with a <th> for each column. If you are trying to initialize an empty table you should try

我认为这与你的标记有关。请记住,dataTables需要一个带有部分的html表,每列都有一个。如果您尝试初始化一个空表,您应该尝试

$('#usersGrid').dataTable({
  aoData: [{}]
});

#2


0  

It's true that dataTables need an html table with <thead> and a <th> for each column. An easier fix however, is to simply add the following line in the code behind, immediately after the databind() call.

DataTables确实需要一个带有的html表和每列的。但更简单的方法是在databind()调用之后立即在后面的代码中添加以下行。

MyGridView.DataSource = <some data source>
MyGridView.DataBind();
MyGridView.HeaderRow.TableSection = TableRowSection.TableHeader; // wraps header row with THEAD element for sorting

#1


6  

I think that this has something to do with your markup. Remember that dataTables needs an html table with <thead> section with a <th> for each column. If you are trying to initialize an empty table you should try

我认为这与你的标记有关。请记住,dataTables需要一个带有部分的html表,每列都有一个。如果您尝试初始化一个空表,您应该尝试

$('#usersGrid').dataTable({
  aoData: [{}]
});

#2


0  

It's true that dataTables need an html table with <thead> and a <th> for each column. An easier fix however, is to simply add the following line in the code behind, immediately after the databind() call.

DataTables确实需要一个带有的html表和每列的。但更简单的方法是在databind()调用之后立即在后面的代码中添加以下行。

MyGridView.DataSource = <some data source>
MyGridView.DataBind();
MyGridView.HeaderRow.TableSection = TableRowSection.TableHeader; // wraps header row with THEAD element for sorting