ASP.NET使用Jquery datatable列表外掛程式

來源:互聯網
上載者:User

標籤:

最近的項目改用bootstrap樣式,表格列表也使用Jquery DataTable外掛程式。樣式挺美觀的。先來張:

1、初始化表格外掛程式

 1 oTable = table 2                     .DataTable( 3                             { 4                                 "language": GlobalDataTablesLang, 5                                 "ordering": false, //開關,排序功能    是否能排序 6                                 "pageLength": 10, // 預設每頁記錄數 7                                 "searching": false, //開關,過濾功能  顯示搜尋 8                                 "lengthChange": true, //開關,改變每頁顯示資料數量  顯示 9                                 "lengthMenu": [ // 設定每頁多少記錄數10                                 [5, 10, 15, 25, 50, 100],11                                         [5, 10, 15, 25, 50, 100]],12                                 "bRetrieve": false,13                                 "columns": [{14                                     "data": "PostID"15                                 }, {16                                     "data": "PostID"17                                 }, {18                                     "data": "PostName"19                                 }, {20                                     "data": "PostGuid"21                                 }, {22                                     "data": "PostBZ"23                                 }],24                                 "serverSide": true,25                                 "ajax": {26                                     "url": "action/GetUserList",27                                     "type": "POST"28                                 },29                                 "fnPreDrawCallback": function () {30                                     App.startPageLoading();31                                     return true;32                                 },33                                 "fnDrawCallback": function () {34                                     App.stopPageLoading();35                                     RenderCheck();36                                 },37                                 "fnRowCallback": function (nRow, aData, iDataIndex) {38                                     return nRow;39                                 }40                             });41 42                         }

 

2、後台返回的資料格式

 

{"draw":"1","recordsTotal":3,"recordsFiltered":3,"data":[{"PostID":0,"PostName":"財務","PostGuid":"f45d761fdbd34dbcbf2d088247a745b8","PostBZ":""},
{"PostID":0,"PostName":"館長","PostGuid":"f4eaba3b7a6d42ba90be23edbd863d8f","PostBZ":""},
{"PostID":0,"PostName":"前台人員","PostGuid":"66cceb2fa22f42b3acda6a069529132d","PostBZ":""}]}

 

 3、重新整理表格

oTable.ajax.reload();

 

ASP.NET使用Jquery datatable列表外掛程式

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.