DataTables warning : Requested unknown parameter '0' from the data source for row 0错误

在做datatables的项目,从后台取得数据后,返回给datatables界面时会报下面的错误:

DataTables warning : Requested unknown parameter '0' from the data source for row 0

加上下面的设置就可以了,至于原理还不是很清楚。

"aoColumnDefs": [
{
 sDefaultContent: '',
 aTargets: [ '_all' ]
  }
],

var oTable = $("#example").dataTable({
    "bDeferRender" : true,
    "bFilter" : false,
    "bDestroy" : true,
    "bProcessing" : true,
    "bSort" : true,
    "bStateSave" : false,
    // 异步处理必须 否则数据发送不到后来
    "bServerSide" : true,
    "sServerMethod" : "POST",
 
    "sAjaxSource" : "${basePath}/logInfo/getLogInfo",
 
    "aoColumns" : [ {
        "bVisible" : true,
        "mData" : "providerName",
        "aTargets" : [ 0 ]
    }, {
        "bVisible" : true,
        "mData" : "propertyName",
        "aTargets" : [ 1 ]
    }, {
        "bVisible" : true,
        "mData" : "roomTypeName",
        "aTargets" : [ 2 ]
    }, {
        "bVisible" : true,
        "mData" : "opMethod",
        "aTargets" : [ 3 ]
    }, {
        "bVisible" : true,
        "mData" : "operatTime",
        "aTargets" : [ 4 ]
    }, {
        "bVisible" : true,
        "mData" : "operator",
        "aTargets" : [ 5 ]
    }, ],
    "aoColumnDefs" : [ {
        sDefaultContent : '',
        aTargets : [ '_all' ]
    } ],
 
    "oLanguage" : {
        "sProcessing" : "正在加载中......",
        "sLengthMenu" : "每页显示 _MENU_ 条记录",
        "sZeroRecords" : "没有数据!",
        "sEmptyTable" : "表中无数据存在!",
        "sInfo" : "当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录",
        "sInfoEmpty" : "显示0到0条记录",
        "sInfoFiltered" : "数据表*为 _MAX_ 条记录",
        "oPaginate" : {
            "sFirst" : "首页",
            "sPrevious" : "上一页",
            "sNext" : "下一页",
            "sLast" : "末页"
        }
    }
 
});

转:http://www.cnblogs.com/VincentHome/p/3964798.html

上一篇:protobuf中文教程(第一篇)


下一篇:C# textBox控件只允许为数字和小数点并且提取出这个数字