I am using MVC. I have large amount of data and I need to have data only with paging limit. For example, if page size is 10 I want to get only top 10 records in my database.
Here is my 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>
And here is my 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"}
],
..........
and this is what my server returns as 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"]]}
When I run the program it gives "can not read propert lenght of undefined" error while it is loading datatable. Where I am doing wrong and thanks for any solution please.
尝试类似JqGrid的操作如果您想通过分页实现自己的表,请像Jqgrid一样进行操作
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.