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!