Bootstrap table分页问题汇总
首先非常感谢作者针对bootstrap table分页问题进行详细的整理,并分享给了大家,希望通过这篇文章可以帮助大家解决Bootstrap table分页的各种问题,谢谢大家的阅读。
问题1 :服务器端取不到form值,querystring没有问题, 但是request.form取不到值
解决:这是ajax的问题,原代码使用原生的ajax。 1可以用读流文件解决。2 如果想用request.form 方式,设置 contentType: "application/x-www-form-urlencoded",
如
|
1
2
3
4
5
6
7
8
9
10
|
$('#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", |
问题2: 设置传递到服务器的参数
方法:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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, |
问题3:后台取不到 pageSize 信息
解决:
1、在queryParams中设置
2、在bootstrap-table.minjs文件 修改源文件为"limit"===this.options.queryParamsType&&(e={limit:e.pageSize,pageNumber:e.pageNumber,
修改 bootstrap-table.js 也可以
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
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);}} |
配置加入 "queryParamsType": "limit",
完整:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
<script type="text/javascript">$(document).ready(function() { $('#tableList').bootstrapTable({method: 'post',url: "getcompapylist",height: $(window).height() - 200,striped: true,dataType: "json",pagination: true,"queryParamsType": "limit",singleSelect: false,contentType: "application/x-www-form-urlencoded",pageSize: 10,pageNumber:1,search: false, //不显示 搜索框showColumns: false, //不显示下拉框(选择显示的列)sidePagination: "server", //服务端请求queryParams: queryParams,//minimunCountColumns: 2,responseHandler: responseHandler,columns: [{field: 'CompanyId',checkbox: true},{field: 'qq',title: 'qq',width: 100,align: 'center',valign: 'middle',sortable: false},{field: 'companyName',title: '姓名',width: 100,align: 'center',valign: 'middle',sortable: false}]});});function responseHandler(res) {if (res.IsOk) {var result = b64.decode(res.ResultValue);var resultStr = $.parseJSON(result);return {"rows": resultStr.Items,"total": resultStr.TotalItems};} else {return {"rows": [],"total": 0};}}//传递的参数function queryParams(params) {return {pageSize: params.limit,pageNumber: params.pageNumber,UserName: 4};}</script> |
问题4:分页后,重新搜索的问题
前提:自定义搜索且有分页功能,比如搜索产品名的功能.
现象:当搜索充气娃娃的时候返回100条记录,翻到第五页. 这时候搜索按摩棒,数据有200条,结果应该是第一页的记录,但是实际显示的还是第五页的结果. 也就是重新搜索后,pagenumber没有变.
解决:重新设置option就行了.
|
1
2
3
4
5
|
function search(){ $('#tableList').bootstrapTable({pageNumber:1,pageSize:10});} |
Bootstrap table分页问题汇总的更多相关文章
- bootstrap table分页(前后端两种方式实现)
bootstrap table分页的两种方式: 前端分页:一次性从数据库查询所有的数据,在前端进行分页(数据量小的时候或者逻辑处理不复杂的话可以使用前端分页) 服务器分页:每次只查询当前页面加载所需要 ...
- bootstrap table 分页序号递增问题 (转)
原文地址:https://segmentfault.com/q/1010000011040346 如题,怎么在bootstrap table中显示序号,序号递增,并且分页有效,等于是每页10条,第2页 ...
- bootstrap table分页,重新数据查询时页码为当前页问题
问题描述: 使用bootstrap table时遇到一个小问题,第一次查询数据未5页,翻页到第5页后,选中条件再次查询数据时,传到后端页码仍旧为5,而此时数据量小于5页,表格显示为未查询到数据. 处理 ...
- bootstrap table分页limit计算pageIndex和pageSize
由于bootstrap table的js无法直接获取pageSize和pageIndex的值,只能通过limit进行计算.
- Bootstrap table 分页 In asp.net MVC
中文翻译文档: http://blog.csdn.net/rickiyeat/article/details/56483577 版本说明: Jquery v2.1.1 Bootstrap V3.3.7 ...
- [转]Bootstrap table 分页 In asp.net MVC
本文转自:https://www.cnblogs.com/lenovo_tiger_love/p/7474403.html 中文翻译文档: http://blog.csdn.net/rickiyeat ...
- bootstrap table 分页后,重新搜索的问题
前提: 自定义搜索且有分页功能,比如搜索产品名的功能. 现象:当搜索充气娃娃的时候返回100条记录,翻到第五页. 这时候搜索按摩棒,数据有200条,结果应该是第一页的记录,但是实际显示的还是第五页的 ...
- bootstrap table分页后刷新跳到第一页
之前这样写是不行的,这时候页数还是原来的页数 $('#tb_departments').bootstrapTable(('refresh')); 需要改成: $("#tb_departmen ...
- bootstrap table 分页显示问题
1.bootstrap-table客户端分页 客户端分页的数据源可以是后台服务器端传递过来(一次性获取,即获取所有你需要的数据),点击页码不再请求后台,利用页面缓存分页;cache : true, / ...
随机推荐
- tomcat普通用户启动不了
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these enviro ...
- docker 部署disconf 以及将其做成镜像
1.需要一台服务器(阿里云,腾讯云.实体服务器都行,本次是以实体服务器为依照做的) 2.安装docker https://www.cnblogs.com/shijunjie/p/10436293. ...
- GreenPlum 大数据平台--外部表(三)
一,外部表介绍 Greenplum 在数据加载上有一个明显的优势,就是支持数据的并发加载,gpfdisk是并发加载的工具,数据库中对应的就是外部表 所谓外部表,就是在数据库中只有表定义.没有数据,数据 ...
- HexChat访问Docker频道
1.使用HexChat登录Freenode.net 2.在Freenode下输入并回车: /msg NickServ REGISTER yourpassword youremail@example.c ...
- (转)超全整理!Linux性能分析工具汇总合集
超全整理!Linux性能分析工具汇总合集 原文:http://rdc.hundsun.com/portal/article/731.html 出于对Linux操作系统的兴趣,以及对底层知识的强烈欲望, ...
- (转)Linux 系统性能分析工具图解读(一、二)
Linux 系统性能分析工具图解读(一.二) 原文:http://oilbeater.com/linux/2014/09/08/linux-performance-tools.html 最近看了 Br ...
- hadoop-2.6.0.tar.gz + spark-1.6.1-bin-hadoop2.6.tgz的集群搭建(单节点)(CentOS系统)
福利 => 每天都推送 欢迎大家,关注微信扫码并加入我的4个微信公众号: 大数据躺过的坑 Java从入门到架构师 人工智能躺过的坑 Java全栈大联盟 ...
- VMware虚拟网卡设置问题
具体操作过程如下: (1)为虚拟机添加虚拟网卡 (2)添加后会自动分配子网ip,不用修改.点击应用,确定. (3)添加完成后本机的网络上会多出一个网络适配器,根据虚拟机器中的ip设置此ip地址, 这里 ...
- 1个示例 学会 mvc 常用标签
HtmlHelper用法大全3:Html.LabelFor.Html.EditorFor.Html.RadioButtonFor.Html.CheckBoxFor @Html.***For:为由指定 ...
- 从零开始写C# MVC框架之--- 项目结构
框架总分2个项目:Web开发项目.帮助类项目 (ZyCommon.Zy.Utilities) 1.ZyCommon,是Web开发项目结构.新建一个空解决方案,再建Data.Service.ZyWeb解 ...