Home >Web Front-end >JS Tutorial >Bootstrap table server-side paging example sharing_jquery

Bootstrap table server-side paging example sharing_jquery

WBOY
WBOYOriginal
2016-05-16 16:14:521609browse

1. The js required for front-end introduction can be downloaded from the official website

Copy code The code is as follows:

function getTab(){
var url = contextPath '/fundRetreatVoucher/fundBatchRetreatVoucherQuery.htm';
$('#tab').bootstrapTable({
method: 'get', //It needs to be set to get here. I don’t know why I can’t get it after setting 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',//Set to server-side paging
queryParams: queryParams,//parameters
showColumns: true,
showRefresh: true,
minimumCountColumns: 2,
clickToSelect: true,
smartDisplay:true,
columns: [
{
field: 'interfaceInfoCode',
title: 'Fund Channel Code',
align: 'center',
width: '180',
valign: 'bottom',
sortable: true
}, {
field: 'retreatBatchCode',
title: 'Fund return batch number',
align: 'center',
width: '200',
valign: 'middle',
sortable: true
}, {
field: 'total',
title: 'Total number of transactions',
align: 'center',
width: '10',
valign: 'top',
sortable: true
}, {
field: 'totalMoney',
title: 'Total amount',
align: 'center',
width: '100',
valign: 'middle',
clickToSelect: false
}, {
title: 'Operation',
field: 'state',
align: 'center',
width: '200',
valign: 'middle',
}]
});
}
//Set the incoming parameters
function queryParams(params) {
Return params
}
$(function(){
getTab();
})

2 Backstage

Get limit offset. On some websites, you need to format the incoming parameters to get pageSize, pageIndex. Anyway, I didn’t succeed. If you know, you can share it with me

Copy code The code is as follows:

int currentPage = request.getParameter("offset") == null ? 1 : Integer.parseInt(request.getParameter("offset"));
//Number of lines per page
int showCount = request.getParameter("limit") == null ? 10 : Integer.parseInt(request.getParameter("limit"));/
if (currentPage != 0) {// Get the number of pages
currentPage = currentPage / showCount;
}
currentPage = 1;
JSONObject json = new JSONObject();
json.put("rows", bfrv); //The keys of rows and total here are fixed
json.put("total", total);

The above is the entire content of this article, I hope you guys will like it.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn