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.