我正在使用MVC。我有大量的数据,我需要只有分页限制的数据。例如,如果页面大小为10,我想在我的数据库中只获得前10条记录。
这是我的HTML:
<table class="table table-striped table-bordered table-hover" id="data_table">
<thead>
<tr>
<th> Anket Id </th>
<th> Anket Adı </th>
<th> Katılımcı </th>
<th> Soru </th>
<th> Aktif Gün </th>
<th> Dil </th>
<th> Durum </th>
<th> Kayıt Tarihi </th>
</table>
这是我的JS:
var table = $('#data_table').DataTable({
"processing": true,
"serverSide": true,
"ajaxSource": "/Survey/ActiveSurveysPaging",
"dataSrc": "",
"aoColumns": [
{ "mDataProp": "Anket Id" },
{ "mDataProp": "Anket Adı" },
{ "mDataProp": "Katılımcı" },
{ "mDataProp": "Soru" },
{ "mDataProp": "Aktif Gün" },
{ "mDataProp": "Dil" },
{ "mDataProp": "Durum" },
{ "mDataProp": "Kayıt Tarihi"}
],
..........
这就是我的服务器返回的json:
{"sEcho": 3,"iTotalRecords" : 1013,"iTotalDisplayRecords" : 1013,"aaData" : [["56523938aa9c580dac1858e5","anket-0","1001","8","11","TR","Aktif","22.11.2015 23:52"],
["5652393aaa9c580dac185918","anket-1","1000","8","11","TR","Aktif","22.11.2015 23:52"]]}
当我运行程序时,它在加载数据表时给出了“无法读取未定义的属性长度”错误。在哪里我做错了,谢谢你的任何解决方案。