Bootstrap table server-side paging example, bootstraptable
1. You can download the js required for front-end introduction from the official website.
Function getTab (){
Var url = contextPath + '/fundRetreatVoucher/fundBatchRetreatVoucherQuery.htm ';
$ ('# Tab'). bootstrapTable ({
Method: 'get', // set this parameter to get. I don't know why post cannot be obtained.
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 it to the server page
QueryParams: queryParams, // Parameter
ShowColumns: true,
ShowRefresh: true,
MinimumCountColumns: 2,
ClickToSelect: true,
SmartDisplay: true,
Columns :[
{
Field: 'interfaceinfocode ',
Title: 'funding channel Code ',
Align: 'center ',
Width: '200 ',
Valign: 'bottom ',
Sortable: true
},{
Field: 'retreatbatchcode ',
Title: 'Fund return Batch No ',
Align: 'center ',
Width: '200 ',
Valign: 'middle ',
Sortable: true
},{
Field: 'Total ',
Title: 'total number ',
Align: 'center ',
Width: '10 ',
Valign: 'top ',
Sortable: true
},{
Field: 'totalmoney ',
Title: 'Total ',
Align: 'center ',
Width: '200 ',
Valign: 'middle ',
ClickToSelect: false
},{
Title: 'operation ',
Field: 'state ',
Align: 'center ',
Width: '200 ',
Valign: 'middle ',
}]
});
}
// Set input parameters
Function queryParams (params ){
Return params
}
$ (Function (){
GetTab ();
})
2 Background
Get limit offset. Some websites need to format input parameters to get pageSize. pageIndex is not successful. If you know, share it with me.
Int currentPage = request. getParameter ("offset") = null? 1: Integer. parseInt (request. getParameter ("offset"); // The number of rows per page int showCount = request. getParameter ("limit") = null? 10: Integer. parseInt (request. getParameter ("limit");/if (currentPage! = 0) {// get the page number currentPage = currentPage/showCount;} currentPage + = 1; JSONObject json = new JSONObject (); json. put ("rows", bfrv); // The keys of rows and total are fixed json. put ("total", total );