bootstrap-table 分页的问题
来源:互联网 发布:幸福狐狸淘宝是真的吗 编辑:程序博客网 时间:2024/05/16 07:11
http://wenzhixin.net.cn/p/bootstrap-table/docs/examples.html#via-javascript-table
问题1 :服务器端取不到form值,querystring没有问题, 但是request.form取不到值
解决:这是ajax的问题,原代码使用原生的ajax。 1可以用读流文件解决。2 如果想用request.form 方式,设置 contentType: "application/x-www-form-urlencoded",
如
$('#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 设置传递到服务器的参数
方法:
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 也可以
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",
完整
<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就行了.
function search(){
$('#tableList').bootstrapTable({pageNumber:1,pageSize:10});
}
- bootstrap-table 分页的问题
- bootstrap-table 分页的问题
- bootstrap-table分页问题
- Bootstrap Table插件且是server端分页的问题
- BootStrap Table分页问题pageNumber/offset
- bootstrap table + spring mvc 服务的分页
- Struts2结合Bootstrap-Table分页的使用
- bootstrap-table遇到的问题
- bootStrap table实现分页
- BootStrap-Table 分页
- Bootstrap Table分页例子
- bootstrap-table后端分页
- bootstrap table 分页
- bootstrap table 分页例子
- BootStrap table分页
- bootstrap-table分页
- ssm分页+bootstrap-table
- bootstrap-table分页小结
- iOS提交程序到Appstore上报错iTunes store operation failed?
- NGUI战斗飘字及界面优化
- Count Numbers with Unique Digits
- C++ 利用make_heap建立小根堆
- esp8266 相关
- bootstrap-table 分页的问题
- 25匹赛马得前三名问题求解
- 关于map函数总结
- 多表联合查询:join的用法
- 站点页面的TDK要有特色,就该这么设置
- Android工具类系列-HttpUtil
- 安装和使用Inforbright
- iOS--tableview单元格重用(单元格上创建控件情况下)
- 未能找到类型或命名空间名称“*”(是否缺少 using 指令或程序集引用?) 异常的解决