0

我正在使用 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"]]}

当我运行程序时,它在加载数据表时给出“无法读取未定义的属性长度”错误。我在哪里做错了,请感谢任何解决方案。

4

1 回答 1

0

尝试类似JqGrid 如果你想用分页实现自己的表格,像 Jqgrid 一样做

于 2015-12-04T14:19:56.223 回答