This article mainly introduces the bootstraptable server-side paging example sharing. For more information, see section 1. you can download the required js introduced at the front end from the official website.
The code is as follows:
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.
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 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 );
The above is all the content of this article. I hope my friends will like it.