繁体   English   中英

在datatables jquery插件中未定义aData?

[英]aData is undefined in datatables jquery plug-in?

我正在使用1.9.4 -jquery.dataTables.js 我得到aData is undefined错误。 我看过几篇关于这个问题的文章,我尝试了一切,但没有任何帮助。

我返回的JSON object是数据表所期望的。 它具有“ aaData”字段,该字段是一个数组数组。 我正在尝试仅使用一列来修复该错误。

我在浏览器上收到一个弹出错误消息

DataTables warning (table id = 'search_table'): list index out of rangelist index out of range

在萤火虫控制台中,我看到了

aData is undefined in 2038 at jquery.dataTable.js

for ( var i=0, iLen=aData.length ; i<iLen ; i++ )
{....

我的json对象;

{"result": "ok", "iTotalRecords": 5, "aaData": [["6200"], ["6900"], ["7500"], ["5800"], ["4600"]], "sEcho": 0, "iTotalDisplayRecords": 5}

我的脚本:

<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:

<div class="well">
                <table id="search_table">
                    <thead>
                            <th width="10%"><center>Title</center></th>

                    </thead>
                    <tbody></tbody>
                </table><br>
</div>

删除"bServerSide": true ,看看它是否有效。 我想您现在不进行任何服务器端处理

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM