dataTables错误:DataTables warning : Requested unknown parameter '1' from the data source for row 0
程序员文章站
2022-06-14 10:23:50
...
困扰了一晚上终于找到了问题的所在,但是并没有找到原因:
问题所在:
{ "data": "OENumber" },
改成:
{ "data": "oeNumber" },
原因是因为属性名的头字母是大写的,导致数据在加载的时候读不出来,改成小写之后问题就解决了。这框架有毒啊。
$('#dataTables-example').dataTable( {
"responsive": true,
//以下两个参数是为了解决第二次点击按钮的时候tomcat会报错
"retrieve":true,
"destroy": true,
"autoWidth":false,
"deferRender": true,
"serverSide": true,
"columnDefs": [ { "sortable": false, "targets": [ 2, 7, 9 , 10] }], //设置某些列不进行排序
"ajax":{
"url" : "get_every_assembly",
"data" : {
ass : assName,
pageNum : 1,
pageSize : 1000
}
},
"columns": [
{ "data": "partId" },
{ "data": "OENumber" }, //问题所在,因为我的属性名是大写的,导致找不到数据,于是我将属性改成小写的。问题就结局了
{ "data": "picture" },
{ "data": "diameter" },
{ "data": "weight" },
{ "data": "price" },
{ "data": "number" },
{ "data": "userId" },
{ "data": "assembleTime" },
{ "data": "desc" },
{ "data": "tags" }
],
"language": {
"processing" : "正在获取数据,请稍后...",
"lengthMenu" : "显示 _MENU_ 条",
"zeroRecords" : "没有您要搜索的内容",
"info" : "从 _START_ 到 _END_ 条记录 总记录数为 _TOTAL_ 条",
"infoEmpty" : "记录数为0",
"infoFiltered" : "(全部记录数 _MAX_ 条)",
"infoPostFix" : "",
"search" : "搜索",
"url" : "",
"paginate": {
"first" : "第一页",
"previous" : "上一页",
"next" : "下一页",
"last" : "最后一页"
}
}
} );
}
上一篇: 浅谈PHP实现伪静态
推荐阅读
-
DataTables warning: table id=dataTable - Requested unknown parameter 'acceptId' for row 0. For more
-
关于->"DataTables warning: table id=vmtable - Requested unknown parameter 'iP' for row 2, column 2"错误解
-
DataTables warning: table id=dataTable - Requested unknown parameter 'acceptId' for row 0. F...
-
dataTables错误:DataTables warning : Requested unknown parameter '1' from the data source for row 0
-
DataTables warning (table id = 'data-table-1'): Requested unknown parameter '9' from the data source