This article mainly introduces the problems encountered during the implementation of the JS component bootstraptable paging. Interested friends can refer to this article to share the bootstrap-table paging issue for your reference, the details are as follows:
Problem 1: The server cannot get the form value, and querystring is normal, but request. form cannot get the value.
Solution: This is an ajax problem. The original code uses native ajax. 1. Read stream files can be used. 2. If you want to use request. form, set contentType: "application/x-www-form-urlencoded ",
For example
$('#tableList').bootstrapTable({method: 'post',url: "",height: $(window).height() - 200,striped: true,dataType: "json",pagination: true,"queryParamsType": "limit",singleSelect: false,contentType: "application/x-www-form-urlencoded",
Question 2: set parameters passed to the server
Method:
function queryParams(params) {return {pageSize: params.limit,pageNumber: params.pageNumber,UserName: 4};} $('#tableList').bootstrapTable({method: 'post',url: "",height: $(window).height() - 200,striped: true,dataType: "json",pagination: true, queryParams: queryParams,
Problem 3: pageSize cannot be obtained in the background
Solution:
1. Set in queryParams
2. Modify the source file in the bootstrap-table.minjs file
"Limit" = this. options. queryParamsType & (e = {limit: e. pageSize, pageNumber: e. pageNumber,
You can also modify bootstrap-table.js
if (this.options.queryParamsType === 'limit') {params = {search: params.searchText,sort: params.sortName,order: params.sortOrder};if (this.options.pagination) {params.limit = this.options.pageSize;params.pageNumber=this.options.pageNumber,params.offset = this.options.pageSize * (this.options.pageNumber - 1);}}
Add "queryParamsType": "limit ",
Complete