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, / ...
随机推荐
- C++ GUI Qt4编程(09)-3.3spreadsheet-toolbar
1. C++ GUI Qt4编程第三章,增加工具栏.状态栏和快捷键. 2. mainwindow.h /**/ #ifndef MAINWINDOW_H #define MAINWINDOW_H #i ...
- PIE SDK栅格数据的创建
1. 功能简介 目前在地理信息领域中数据包括矢量和栅格两种数据组织形式.每一种数据有不同的数据格式,目前PIE SDK支持多种数据格式的数据创建,下面对栅格数据格式的数据创建功能进行介绍. 2. 功能 ...
- ics httpDELETE 时增加 content,length 特别需求
unit: OverbyteIcsHttpProt.pasprocedure THttpCli.SendRequest(const Method, Version: String); var Head ...
- Kafka使用多个分区时 consumer的Assign配置
天天在给自己挖坑排坑... 因为要开多线程消费,所以分区加到了10,两个broker. Producer没有做特殊处理,所以是随机发到Partitions. 但是Consumer只做Subscribe ...
- python查看模块版本及所在文件夹
# 以Numpy为例 第一种方法:import numpy as np np.__version__ >>> '1.12.1' np.__file__ >>> '/ ...
- windows删除指定日期前的文件
@ echo offforfiles /p .\ /s /m 2008*.* /d -7 /c "cmd /c echo @file>>.\del.txt"forfil ...
- 基于memcache的缓存机制的6个指令
Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站的速度.Memcached ...
- rsync 参数配置说明[转]
rsync 特性 可以镜像保存整个目录树和文件系统. 可以很容易做到保持原来文件的权限.时间.软硬链接等等. 无须特殊权限即可安装. 快速:第一次同步时 rsync 会复制全部内容,但在下一次只传输修 ...
- 内置组件 && vue中强大的缓存机制之keep-alive
vue中强大的缓存机制之keep-alive 最近在用vue做项目,在切换页面时发现切换回原来的页面无法保存原来的状态. 如A页面需要ajax请求数据,然后切换到B页面做某些事情,再切换回A页面时,A ...
- xsd表示byte[]的类型
byte[]对应xs:base64Binary http://stackoverflow.com/questions/5912526/representing-byte-array-as-an-xsd ...