DataTables v1.9.4 DataTables警告(表id = 'tblMyDataTable'):从第1行的数据源中请求未知参数'0'。

时间:2022-10-07 16:13:06

Response from server is:

响应从服务器:

{"aaData":[["01/02/1980","02/02/1980","Text1","321"],["01/02/1990","02/02/1990","Text2","404"],["01/02/2000","02/02/2000","Text3","515"]]}

{“aaData”:[[“01/02/1980”、“02/02/1980”,“Text1”,“321”],[“01/02/1990”、“02/02/1990”,“Text2”,“404”],[“01/02/2000”、“02/02/2000”,“Text3”,“515”]]}

My HTML is:

我的HTML是:

<table id="tblMyDataTable"> 
    <thead> 
    <tr role="row">
        <th>Date1</th>
    <th>Date2</th>
    <th>Text</th>
    <th>Number</th> 
    </tr> 
</thead> 
<tbody></tbody>
</table>

and, my javascript is:

,我的javascript是:

$('#tblMyDatTable').dataTable();

I put above response into dataTable like this:

我将上述的反应放到dataTable中:

$('#tblMyDatTable').dataTable().fnAddData(data);

and get error message in title of this post.

并在标题中获取错误信息。

I tried aoColumns as mData and mDataProp per another SO post, same error as above. (And, still puzzled why necessary when DataTables documentation example shows not there, just give server response to fnAddData.

我尝试了aoColumns作为mData和mDataProp,所以post,和上面一样的错误。(而且,在DataTables文档示例显示不存在的情况下,为什么需要提供服务器对fnAddData的响应,仍然感到困惑。

1 个解决方案

#1


0  

see https://*.com/a/24786199/849417

参见https://*.com/a/24786199/849417

add $.fn.dataTableExt.sErrMode = 'throw' in the page where the plugin is used

添加.fn.dataTableExt美元。sErrMode = 'throw'在插件使用的页面。

#1


0  

see https://*.com/a/24786199/849417

参见https://*.com/a/24786199/849417

add $.fn.dataTableExt.sErrMode = 'throw' in the page where the plugin is used

添加.fn.dataTableExt美元。sErrMode = 'throw'在插件使用的页面。