关于datatableswarningtableid的信息

http://www.itjxue.com  2023-01-25 06:44  来源:未知  点击次数: 

H-ui.admin v2.3总出现datatable warning:table id=data

重点内容

DataTables warning: table id=dataTable - Requested unknown parameter ‘acceptId’ for row 0. For more information about this error, please see

使用jquery.datatable时发生上面错误,配置如下:

table = $("#dataTable").dataTable({

"scrollY": "400px", //高度

"scrollX": true, //左右滚动条

"ordering":false,//thead上的排序按钮

"bLengthChange": false,//分页条数选择按钮

"bProcessing": true,//显示加载中

"bInfo": false,//页脚信息显示

"searching":false,//搜索输入框显示

"sPaginationType": "full_numbers",//分页显示样式

"paging":true,//

"sAjaxSource": '%= basePath %sellcar/getSellCarOrderList',

"bProcessing" : true,

"bServerSide" : true,

"oLanguage": {

"sLengthMenu": "每页显示 _MENU_ 条",

"sZeroRecords": "没有找到符合条件的数据",

"sProcessing": "我也是醉了,正在加载数据...",

"sInfo": "当前第 _START_ - _END_ 条 共计 _TOTAL_ 条",

"sInfoEmpty": "没有有记录",

"sInfoFiltered": "(从 _MAX_ 条记录中过滤)",

"sSearch": "搜索:",

"oPaginate": {

"sFirst": "首页",

"sPrevious": "前一页",

"sNext": "后一页",

"sLast": "尾页"

}

},

"aoColumns": [

//{ "sDefaultContent": ' '},

{ "mData":"brandName",'sClass':'left',

"mRender":function(data,type,full) {

var cusId = full.customerId;

var sellNo = full.sellNo;

var content = "tdinput type='checkbox' name='batchAllocated' id='batchAllocated' value='"+cusId+"' sell_no='"+sellNo+"'/td";

return content;

}

},

{ "mData":"brandId",

"mRender":function(data,type,full){

if(full.carBrand!=null){

return full.carBrand.brandName;

};

return "";

}

},

{ "mData":"serieId",

"mRender":function(data,type,full){

if(full.carSerie!=null){

return full.carSerie.serieName;

};

return "";

}

},

{ "mData":"customeId",

"mRender":function(data,type,full){

if(full.customer!=null){

return full.customer.userName;

};

return "";

}

},

{ "mData":"phoneNo"},

{ "mData":"createdFormat"},

{ "mData":"sellStatus",'sClass':'left',

"mRender":function(data,type,full) {

var sellStatus = full.sellStatus;

var content = "";

if(sellStatus==0){

content = "待估车";

}else if(sellStatus==10){

content = "估车成功";

if(full.recordStatus == "wlr"){

content = "估车成功,未录入";

}else if(full.recordStatus == "ylr"){

content = "已录入";

}

if(full.item !=null){

var item = full.item;

if(item.carStatus == "ysh"){

content = "通过审核";

if(item.carOnSale == 0){

content = "待上架";

}else if(item.carOnSale ==1){

content ="上架";

}else if(item.carOnSale == 2){

content = "下架";

}else if(item.carOnSale == 3){

content = "已售";

}else if(item.carOnSale == 4){

content = "申请下架";

}

}else if(item.carStatus =="dsh"){

content = "待审核";

}else if(item.carStatus == "wsh"){

content = "未通过审核";

}

}

}else if(sellStatus==20){

content = "重新估车";

}else if(sellStatus == 30){

content = "估车失败,结束";

}else if(sellStatus == 40){

content = "无效信息";

}

return content;

}

},

{ "mData":"acceptId",

"mRender":function(data,type,full){

if(data !=null){

if(full.acceptUser !=null){

return full.acceptUser.userName;

}

}

}

},

{ "mData":"carStatus",'sClass':'left',

"mRender":function(data,type,full) {

var content = "a href='javascript:void(0);' class='show_info' info_id='"+full.sellNo+"'查看/a";

return content;

}

},

{ "mData":"isAllocated",'sClass':'left',

"mRender":function(data,type,full) {

var isAllocated = full.isAllocated;

var content = "";

if(isAllocated==0){

content = "a href='javascript:void(0);' class='change_info' info_id='"+full.sellNo+"' cus_id='"+full.customerId+"'分配/a";

}else{

content = "a href='javascript:void(0);' class='change_info' info_id='"+full.sellNo+"' cus_id='"+full.customerId+"'重新分配/a";

}

return content;

}

}],

// "bLengthChange": true,// 控制每页显示记录数

"iDisplayLength": 10, // 每页显示数量

"fnServerData" : function(sSource, aoData, fnCallback) {

$.ajax({

"type" : 'post',

"url" : sSource,

"dataType" : "json",

"data" : {

aoData : JSON.stringify(aoData),

searchData: JSON.stringify(searchData)

},

"success" : function(resp) {

fnCallback(resp);

var datas=resp.aaData;

},

error: function(resp){

}

});

}/* ,

"fnRowCallback": function(nRow, aData, iDisplayIndex) {

// 当创建了行,但还未绘制到屏幕上的时候调用,通常用于改变行的class风格,此处用于显示‘表格序号’

$('td:eq(0)', nRow).html(iDisplayIndex+1);

return nRow;

} */

});123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160

提示acceptId找不到,解决方案:

{ "mData":"acceptId",

"mRender":function(data,type,full){

if(data !=null){

if(full.acceptUser !=null){

return full.acceptUser.userName;

}

}else{

return "";

}

}

}1234567891011

在写mRender时,必须所有路径都要有返回值,做了空值判断,但是没有给返回值所以出现了上述错误,做个记录,以备后续使用。

jquery.datatable插件如何不自动加载数据?

$(window).load(function () {

$('#managertable').dataTable({

"bServerSide": true,

"bAutoWidth": true,

"bStateSave": false, //保存状态到cookie ******很重要 , 当搜索的时候页面一刷新会导致搜索的消失。使用这个属性设置为true就可避免了

"bPaginate": true, // 是否使用分页

"bProcessing": true, //是否显示正在处理的提示

"bLengthChange": false, //是否启用设置每页显示记录数

"iDisplayLength": 20, //默认每页显示的记录数

"bFilter": true, //是否使用搜索

"bJQueryUI": true, //页面风格使用jQuery.

// "sScrollY": 200,//竖向滚动条 tbody区域的高度

"sScrollX": "100%", //横向滚动条

"sScrollXInner": "100%",

"bScrollCollapse": true,

"aoColumns": [{ "sTitle": "Id" },

{ "sTitle": "Name" },

{ "sTitle": "Permission" },

{ "sTitle": "Remarks"}],

"sPaginationType": "full_numbers", //分页样式

"bAutoWidth": true, //列的宽度会根据table的宽度自适应

"bSort": false, //是否使用排序

"aaSorting": [[0, "desc"]],

"sAjaxSource": "/action/admin/index.ashx?paraname=admingroupmanagersub_detail_id=" + $.cookies.get('sub_detail_id')

});

});

下面是ajaxsource响应:

[{"Id":1,"Name":"管理员组","Permission":"100,110,120,130,200,210,220,300,310,320,330,400,410,420,430,500,510,520,600,610,620,630,631,632,633,634,640,700,710,720,730,740,800,810,820,830","Remarks":""}]

绑定不上:var aData = _fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ); //这里的json是有响应的数据

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

这里aData获取到的是:undefined; 这里解决了,

现在出现这个问题:

Showing 1 to NaN of NaN entries (filtered from NaN total entries)

DataTables warning (table id = 'managertable'): Requested unknown parameter '0' from the data source for row 0

DataTables warning: table id=DataTables_Table_0 - Cannot reinitialise DataTable.

$('.table-sort').dataTable({ "aaSorting": [[ 1, "desc" ]],//默认第几个排序

"bStateSave": true,//状态保存

"pading":false,

"aoColumnDefs": [ //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示

{"orderable":false,"aTargets":[0,7]}// 不参与排序的列 ]

});

【Datatable】Requested?unknown?parameter?'type'?for?row?19

DataTables warning: table id=bank_array - Requested unknown parameter 'type' for row 19. For more information about this error, please see

主要是数据中字段为null导致,添加 "defaultContent":""

H-ui.admin v2.3总出现datatable warning:table id=datatables...请问大神们怎么解决?急

列错误和行错误,要想使用dataTables的前台分页功能才能使用。

1.要想使用dataTables的前台分页功能,必不可少的肯定是要引入jquery.dataTables.min.js文件;

2.一定要在页面中加入对哪个对象的方法引用:$('.table-sort').dataTable({ ? ? ? ? ? ?"aaSorting" : [ [ 3, "desc" ] ],//默认第几个排序,asc升序 desc降序 ? ? ? ? ? ?"bStateSave" : true,//状态保存 ? ? ? ? ? ?//"bLengthChange" : false, //去掉每页显示多少条数据方法 ? ? ? ? ? ?"aoColumnDefs" : [ ? ? ? ? ? ? ? ?//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示 ? ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? ? ? ?"orderable" : false, ? ? ? ? ? ? ? ? ? ?"aTargets" : [ 1,4 ] //不参与排序的列,编号从0开始 ? ? ? ? ? ? ? ?} // 不参与排序的列 ? ? ? ? ? ?] ? ? ? ?});

3.当出现DataTables warning的提示时,首先考虑第一种错误:列超区范围;即一共5列,控制排序的列不能超过4

4.本来查到的没有数据,但是分页中却显示有1条数据存在,这个地方,需要考虑前台是如何获取到数据的:前台是通过td标签获取数据条数的,有几个td就会有多少数据,但是如果设置了无数据判断,一定不要用td来提示。

(责任编辑:IT教学网)

更多

推荐安全产品文章