DataTables warning (table id = 'myTable'): Requested unknown parameter '0' from the data source for row 0
2014-03-24 16:43
453 查看
第一种方式:不用在js里设置列
Html:
Javascript:
Controller:
---------------FireBug------------
数组格式:
第二种方式:要在js里设置列
Html:
Javascript:
Controller:
---------------FireBug------------
Javascript对象格式:
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-1, f.Field-2, f.Field-3, f.Field-4, f.Field-5, f.Field-6, f.Field-7, f.Field-8, f.Field-9, f.Field-10, f.Field-11, f.Field-12 ...... };
---------------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 : Requested unknown parameter '0' from the data source for row 0错误
- DataTables warning : Requested unknown parameter '1' from the data source for row 0错误
- DataTables warning : Requested unknown parameter '1' from the data source for row 0错误
- DataTables warning : Requested unknown parameter '5' from the data source for row 0
- Jquery DataTables warning : Requested unknown from the data source for row 0
- datatables request unknown parameter '0' from data source for row 0
- find the physical location for specified data row
- DataTables warning (table id = 'data-table-1'): Requested unknown parameter '9' from the data source
- Reproting services:Cannot read the next data row for the data set Primary.
- Open Source Big Data for the Impatient, Part 1
- How to get the data from a cell when I click on the GridButtonColumn of the same row
- find the physical location for specified data row
- Microsoft SQL Server 2008 R2 XML处理 One solution is to increase the number of characters retrieved from the server for XML data.
- No data exists for the row or column.
- using INSTR function for obtaining data from a table, based on a selection from the master table (FK relation)
- Comet: Reverse Ajax for streaming data from the server
- Failed to write image data for the launch image set from "LaunchImage.launchimage/1242_2208.png" to
- Error occurred whiLe getting the data source contents for the report
- The method queryForMap(String, Object...) from the type JdbcTemplate refers to the missing type DataAccessException
- How-to: Set up the delta upload for Vendor Master Data from CRM to ERP