BootStrapTable server paging instance resolution, bootstraptable Paging

Source: Internet
Author: User

BootStrapTable server paging instance resolution, bootstraptable Paging

Tables are often used in projects. Paging is required when the data volume is large. during the project design stage, I chose the js plug-in of bootstrapTable. I personally think this framework is very useful and supports paging on the server side, this article focuses on server paging. When a problem occurs, the server page is displayed. The parameter received on the server side is null. No parameter found

Mainly introduces js

<script type="text/javascript" src="<%=path%>/plugins/bootstrap-table/bootstrap-table.js"></script> <script type="text/javascript" src="<%=path%>/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
$ ('# Bootstrap_table '). bootstrapTable ({method: 'post', url: basePath + "/XXXServlet", <span style = "color: # FF0000;"> contentType: "application/x-www-form-urlencoded", </span> cache: false, striped: true, // height: 480, locale: 'zh-cn', sidePagination: 'server', pagination: true, clickToSelect: true, // You can select sortName: 'sendtime' by clicking a row, // you can set the default sorting to SENDTIME sortOrder: 'desc ', // set the order to desc pageSize: 10, pageNumber: 1, pageList: [10, 20, 50,100,200,500], queryParams: function (e) {var param = {userId: $ ("# userId "). val (), type: "db", <span style = "color: # FF0000;"> pageSize: e. limit, pageIndex: (e. offset/e. limit) + 1, <span style = "color: #000000;"> filterlist: $ ("# oms_search_type "). val () </span>}; return param;}, search: false, showColumns: false, showRefresh: false, columns: [{field: "ID ", title: "No.", align: "center", valign: "middle", sortable: "true" },{ field: "NAME", title: "NAME", align: "center", valign: "middle", sortable: "true" },{ field: "AGE", title: "AGE", align: "center", valign: "middle", sortable: "true"}, {title: "operation", field: "id", align: "center", formatter: function (value, row, index) {var e = '<a href = "#" mce_href = "#" onclick = "edit (\'' + row. id + '\') "> edit </a> '; var d = '<a href = "#" mce_href = "#" onclick = "del (\'' + row. id + '\') "> Delete </a> '; return e + d ;}}], onLoadSuccess: function (data) {initUserInfo (data. userInfo) ;}, formatNoMatches: function () {return 'no matching record ';}, onDblClickRow: function (row, $ element ){}});

Note the red part. At that time, the post request was. Note that

<span style="color:#FF0000;">contentType : "application/x-www-form-urlencoded",</span> 

This parameter must be set. Otherwise, the server cannot obtain the parameter.

The above section describes how to resolve the BootStrapTable server paging instance. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.