DataTables warning (table id = 'myTable'): Requested unknown parameter '0' from the data source for row 0
第一种方式:不用在js里设置列
Html:
<table id="myTable">
<thead>
<tr>
<th>Title-1</th>
<th>Title-2</th>
<th>Title-3</th>
<th>Title-4</th>
<th>Title-5</th>
<th>Title-6</th>
<th>Title-7</th>
<th>Title-8</th>
<th>Title-9</th>
<th>Title-10</th>
<th>Title-11</th>
<th>Title-12</th>
......
</tr>
</thead>
<tbody></tbody>
</table>
Javascript:
<script type="text/javascript">
$(function () {
$('#myTable').dataTable({
"bServerSide": true,
"sAjaxSource": "/Home/TodaySO",
"bPaginage": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 5,
"oLanguage": { "sUrl": "/Scripts/DataTable/dataTable_cn.txt" }//多语言配置 //注意这里没有配置列的信息!
});//end table
});//end ready()
</script>
Controller:
var result = from f in filteredData.OrderBy(o => o.SalesOrder)
.Skip(param.iDisplayStart)
.Take(param.iDisplayLength)
.ToList()
select new[]{
f.Field-,
f.Field-,
f.Field-,
f.Field-,
f.Field-,
f.Field-,
f.Field-,
f.Field-,
f.Field-,
f.Field-,
f.Field-,
f.Field-
......
};
---------------FireBug------------
数组格式:
{"sEcho":"1","iTotalRecords":2210,"iTotalDisplayRecords":2210,
"aaData":[
["3004582952","10 "],
["3004582952","100 "],
["3004582952","20 "],
["3004582952","30 "],
["3004582952","40 "]
]
}
第二种方式:要在js里设置列
Html:
<table id="myTable">
<thead>
<tr>
<th>Title-1</th>
<th>Title-2</th>
<th>Title-3</th>
<th>Title-4</th>
<th>Title-5</th>
<th>Title-6</th>
<th>Title-7</th>
<th>Title-8</th>
<th>Title-9</th>
<th>Title-10</th>
<th>Title-11</th>
<th>Title-12</th>
......
</tr>
</thead>
<tbody></tbody>
</table>
Javascript:
<script type="text/javascript">
$(function () {
$('#myTable').dataTable({
"bServerSide": true,
"sAjaxSource": "/Home/TodaySO",
"bPaginage": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 5,
"oLanguage": { "sUrl": "/Scripts/DataTable/dataTable_cn.txt" },//多语言配置
"aoColumns": [
{ "mData": "Field-1" },
{ "mData": "Field-2" },
{ "mData": "Field-3" },
{ "mData": "Field-4" } ,
{ "mData": "Field-5" } ,
{ "mData": "Field-6" } ,
{ "mData": "Field-7" } ,
{ "mData": "Field-8" } ,
{ "mData": "Field-9" } ,
{ "mData": "Field-10" } ,
{ "mData": "Field-11" } ,
{ "mData": "Field-12" }
......
]
});//end table
});//end ready()
</script>
Controller:
var result = from f in filteredData
.OrderBy(o => o.SalesOrder)
.Skip(param.iDisplayStart)
.Take(param.iDisplayLength)
select f;
---------------FireBug------------
Javascript对象格式:
{
"sEcho":"1",
"iTotalRecords":2210,
"iTotalDisplayRecords":2210,
"aaData":[
{"SalesOrder":"3004582952","SalesOrderItem":"10 ","CustomerPO":"SEG131800",...},
{"SalesOrder":"3004582952","SalesOrderItem":"100 ","CustomerPO":"SEG131801",...},
{"SalesOrder":"3004582952","SalesOrderItem":"20 ","CustomerPO":"SEG131802",...},
{"SalesOrder":"3004582952","SalesOrderItem":"30 ","CustomerPO":"SEG131803",...},
{"SalesOrder":"3004582952","SalesOrderItem":"40 ","CustomerPO":"SEG131804",...}
]
}
DataTables warning (table id = 'myTable'): Requested unknown parameter '0' from the data source for row 0的更多相关文章
- DataTables warning: table id=data-table - Requested unknown parameter '3' for row 0.
本文为博主原创,未经允许,不得转载: 在使用jquery 的datatable时,报错在页面弹出弹出框,并提示以下内容: DataTables warning: table id=data-table ...
- DataTables warning: table id=dataTable - Requested unknown parameter 'acceptId' for row 0. For more
重点内容 DataTables warning: table id=dataTable - Requested unknown parameter 'acceptId' for row 0. For ...
- DataTables warning : Requested unknown parameter '5' from the data source for row 0
在该项目中我使用了jquery.dataTables.js来作为我的前端数据表格. 表格的官网地址:https://www.datatables.net/ 一.jsp部分代码片段如下: <tab ...
- DataTables warning: table id=DataTables_Table_0 - Requested unknown parameter '1' for row 0. For more information about this error, please see http://datatables.net/tn/4
今天在做后台的时候,考虑到会员模块和订单模块列表显示差不多,于是乎,偷了个懒,把会员列表显示页面的代码拷贝了过来,修改了一下,变成了订单模块.可是,在订单列表显示的时候老是报下面的错误,截图如下: 后 ...
- DataTables warning : Requested unknown parameter '0' from the data source for row 0错误
在做datatables的项目,从后台取得数据后,返回给datatables界面时会报下面的错误: DataTables warning : Requested unknown parameter ' ...
- Jquery DataTables warning : Requested unknown from the data source for row 0
昨天在做 Jquery DataTables 的时候,遇到的一个问题,我使用MVC,在tables上加入了一个actionlink的href.但是在运行起来的时候,报错: DataTables war ...
- laravel框架中报错 DataTables warning: table id=xxx-table - Cannot reinitialise DataTable.
laravel框架中报错 DataTables warning: table id=xxx-table - Cannot reinitialise DataTable. 分析: initializin ...
- Vue+DataTables warning:table id=xxxx -Cannot reinitialize DataTable.报错解决方法
问题描述: 使用DataTables来写列表,用vue来渲染数据,有搜索功能,每次点击搜索就会报错,如下图所示. 问题排查: 找了一系列原因,最后发现是我每次请求完数据之后都会添加分页功能,从而导致了 ...
- DataTables warning (table id = 'DataTables_Table_0');错误解决办法!
这个错误是table表格引起的,我是将条件语句和<td>标签做了调整后,消除的,个人认为是数据缺失引起的.
随机推荐
- leetcode—sqrt
1.题目描述 Implement int sqrt(int x). Compute and return the square root of x. 2.解法分析 很明显,用二分搜索可解,但是 ...
- wireshark筛选器汇总
抓取指定IP地址的数据流: 如果你的抓包环境下有很多主机正在通讯,可以考虑使用所观察主机的IP地址来进行过滤.以下为IP地址抓包过滤示例: host 10.3.1.1:抓取发到/来自10.3.1.1的 ...
- Java每日一则-001
Java中类名与文件名的关系 1.Java保存的文件名必须与类名一致: 2.如果文件中只有一个类,文件名必须与类名一致: 3.一个Java文件中只能有一个public类: 4.如果文件中不止一个类,文 ...
- EasyMock
使用 EasyMock 更轻松地进行测试 窥探EasyMock(1)基础使用篇 窥探EasyMock(2)进阶使用篇
- JSP学习初体验
JSP简介: 1)JSP--Java Server Pages 2)拥有servlet的特性与优点(本身就是一个servlet) 3)直接在HEML中内嵌JSP代码 4)JSP程序由JSP Engin ...
- ocp 1Z0-047 61-130题解析
61. Evaluate the following SQL statements that are issued in the given order:CREATE TABLE emp(emp_no ...
- UVALive 7461 Separating Pebbles (计算几何)
Separating Pebbles 题目链接: http://acm.hust.edu.cn/vjudge/contest/127401#problem/H Description http://7 ...
- contest7.20(暴力专练)
此次练习的地址: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26732#overview 密码 acmore Problem A(P ...
- jq简单选项卡
function tabControl(obj,elm){ $(obj).hover(function(){ $(this).addClass('active').siblings().removeC ...
- Spring Hibernate4 整合配置文档
1 applicationContext.xml配置文档 <?xml version="1.0" encoding="UTF-8"?><bea ...