1,前臺引入所需的js 可以從官網(wǎng)上下載
function getTab(){
var url = contextPath+'/fundRetreatVoucher/fundBatchRetreatVoucherQuery.htm';
$('#tab').bootstrapTable({
method: 'get', //這里要設(shè)置為get,不知道為什么 設(shè)置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',//設(shè)置為服務(wù)器端分頁
queryParams: queryParams,//參數(shù)
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: '總筆數(shù)',
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',
}]
});
}
//設(shè)置傳入?yún)?shù)
function queryParams(params) {
return params
}
$(function(){
getTab();
})
2 后臺
獲取limit offset ,有些網(wǎng)站上 要格式化傳入?yún)?shù) 獲取pageSize,pageIndex 反正我是沒有成功,如果知道 可以分享給我
int currentPage = request.getParameter("offset") == null ? 1 : Integer.parseInt(request.getParameter("offset"));
// 每頁行數(shù)
int showCount = request.getParameter("limit") == null ? 10 : Integer.parseInt(request.getParameter("limit"));/
if (currentPage != 0) {// 獲取頁數(shù)
currentPage = currentPage / showCount;
}
currentPage += 1;
JSONObject json = new JSONObject();
json.put("rows", bfrv); //這里的 rows 和total 的key 是固定的
json.put("total", total);
以上所述就是本文的全部內(nèi)容了,希望小伙伴們能夠喜歡。