Solve the problems encountered during the implementation of JS component bootstraptable Paging

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.