[英]aData is undefined in datatables jquery plug-in?
I am using 1.9.4 -jquery.dataTables.js
. 我正在使用
1.9.4 -jquery.dataTables.js
。 I get aData is undefined
error. 我得到
aData is undefined
错误。 I have seen several posts that on this issue, I tried everything but none helped. 我看过几篇关于这个问题的文章,我尝试了一切,但没有任何帮助。
My JSON object
that is returned is what datatables expects. 我返回的
JSON object
是数据表所期望的。 it has "aaData" field which is an array of arrays. 它具有“ aaData”字段,该字段是一个数组数组。 I am trying out with only one column to fix the bug.
我正在尝试仅使用一列来修复该错误。
I get a pop-up error-message on the browser 我在浏览器上收到一个弹出错误消息
DataTables warning (table id = 'search_table'): list index out of rangelist index out of range
In the firebug console, I see 在萤火虫控制台中,我看到了
aData is undefined in 2038 at jquery.dataTable.js
for ( var i=0, iLen=aData.length ; i<iLen ; i++ )
{....
my json object; 我的json对象;
{"result": "ok", "iTotalRecords": 5, "aaData": [["6200"], ["6900"], ["7500"], ["5800"], ["4600"]], "sEcho": 0, "iTotalDisplayRecords": 5}
my script: 我的脚本:
<script type="text/javascript">
$(document).ready(function() {
var oTable = $('#search_table').dataTable( {
//"sDom": 'T<"clear">lrtip',
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/search/list",
//"aData":"aaData"
//"sAjaxDataProp": "aaData"
//"aoColumns":[
// {"mDataProp":""},
// {"mDataProp":"username"}
//]
//"aaSorting": [ [1,'desc'], [2,'desc'] ],
// Disable sorting for the Actions column.
//"aoColumnDefs": [ { "bSortable": false, "aTargets": [ 4 ] } ]
} );
} );
</script>
HTML: HTML:
<div class="well">
<table id="search_table">
<thead>
<th width="10%"><center>Title</center></th>
</thead>
<tbody></tbody>
</table><br>
</div>
Remove "bServerSide": true
, and see if it works. 删除
"bServerSide": true
,看看它是否有效。 I guess you are not doing any serverside proecessing now 我想您现在不进行任何服务器端处理
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.