Last active
November 30, 2015 03:40
-
-
Save tingwei628/aec48c3ade0327ebf240 to your computer and use it in GitHub Desktop.
[Bootstrap-table][JavaScript]利用Bootstrap-Table 配合後端作分頁(With server-side pagination) 並下OData參數
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Bootstrap-Table: http://bootstrap-table.wenzhixin.net.cn/documentation/ | |
練習下OData參數,從後端分頁GET資料 | |
*/ | |
$('#table').bootstrapTable({ | |
url: '',//api | |
cache: false, | |
contentType: 'application/json', | |
pageNumber: 1, // 起始第1頁 | |
pageSize:10, //一頁10筆 | |
queryParams:function(params){ | |
return { | |
//url parameters | |
$inlinecount: 'allpages', //回傳total | |
$orderby: 'aaa desc', //對aaa欄位作降冪排序 | |
$skip: params.offset, //params.offset = pageNumber = 1 | |
$top:params.limit //params.limit = pageSize = 10 | |
}; | |
columns:[{}] //表格欄位 | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment