bootstrap table 伺服器端分頁例子分享,bootstraptable

來源:互聯網
上載者:User

bootstrap table 伺服器端分頁例子分享,bootstraptable

1,前台引入所需的js 可以從官網上下載

複製代碼 代碼如下:
function getTab(){
var url = contextPath+'/fundRetreatVoucher/fundBatchRetreatVoucherQuery.htm';
$('#tab').bootstrapTable({
method: 'get', //這裡要設定為get,不知道為什麼 設定post擷取不了
url: url,
cache: false,
height: 400,
striped: true,
pagination: true,
pageList: [10,20],
// contentType: "application/x-www-form-urlencoded",
pageSize:10,
pageNumber:1,
search: true,
sidePagination:'server',//設定為伺服器端分頁
queryParams: queryParams,//參數
showColumns: true,
showRefresh: true,
minimumCountColumns: 2,
clickToSelect: true,
smartDisplay:true,
columns: [
{
field: 'interfaceInfoCode',
title: '資金通道編碼',
align: 'center',
width: '180',
valign: 'bottom',
sortable: true
}, {
field: 'retreatBatchCode',
title: '資金退回批次號',
align: 'center',
width: '200',
valign: 'middle',
sortable: true
}, {
field: 'total',
title: '總筆數',
align: 'center',
width: '10',
valign: 'top',
sortable: true
}, {
field: 'totalMoney',
title: '總金額',
align: 'center',
width: '100',
valign: 'middle',
clickToSelect: false
}, {
title: '操作',
field: 'state',
align: 'center',
width: '200',
valign: 'middle',
}]
});
}
//設定傳入參數
function queryParams(params) {
  return params
}
$(function(){
getTab();
})

2 後台

擷取limit offset ,有些網站上 要格式化傳入參數 擷取pageSize,pageIndex 反正我是沒有成功,如果知道 可以分享給我

複製代碼 代碼如下:
int currentPage = request.getParameter("offset") == null ? 1 : Integer.parseInt(request.getParameter("offset"));
  // 每頁行數
  int showCount = request.getParameter("limit") == null ? 10 : Integer.parseInt(request.getParameter("limit"));/
  if (currentPage != 0) {// 擷取頁數
   currentPage = currentPage / showCount;
  }
  currentPage += 1;
  JSONObject json = new JSONObject();
  json.put("rows", bfrv); //這裡的 rows 和total 的key 是固定的
  json.put("total", total);

以上所述就是本文的全部內容了,希望小夥伴們能夠喜歡。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.