Skip to content

Instantly share code, notes, and snippets.

@tingwei628
Last active November 30, 2015 03:40
Show Gist options
  • Save tingwei628/aec48c3ade0327ebf240 to your computer and use it in GitHub Desktop.
Save tingwei628/aec48c3ade0327ebf240 to your computer and use it in GitHub Desktop.
[Bootstrap-table][JavaScript]利用Bootstrap-Table 配合後端作分頁(With server-side pagination) 並下OData參數
/*
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