首页 > 代码库 > DataTables warning : Requested unknown parameter '0' from the data source for row 0错误
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
DataTables warning : Requested unknown parameter '0' from the data source for row 0错误