bootstrap-table 分页
2017-09-29 12:33
302 查看
----------------------前台
<%--
查询按钮事件
--%>
function search()
{
$('#tableList').bootstrapTable("refresh");
}
<%--
初始化
--%>
$(function () {
//1.初始化Table
var tableInit = new TableInit();
tableInit.Init();
});
var TableInit = function () {
var oTableInit = new Object();
//初始化Table
oTableInit.Init = function () {
$('#tableList').bootstrapTable({
url: 'queryQuestion.action', //请求后台的URL(*)
queryParamsType: 'limit',
method: 'post', //请求方式(*)
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
pagination: true,
limit:10, //初始化加载第一页,默认第一页
offset: 0, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
height: 500, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
columns: [
{
field: 'id',
title: '编号'
},
{
field: 'type',
title: '类型'
},
{
field: 'name',
title: '问题'
},
{
field: 'content',
width:500,
title: '内容',
formatter:function(value,row,index){
var e = '呵呵';
return e;
}
},
{
field: 'content',
title: '删除',
formatter:function(value,row,index){
var e = '<a href="#" mce_href="#" onclick="edit(\''+ row.id + '\')">编辑</a> ';
return e;
}
}
],
queryParams: function (params) {
return {
questionName:$("#questionName").val(),
limit: params.limit,
offset: params.offset
}
},
});
};
return oTableInit;
}
------------后台
@RequestMapping(value = "/queryQuestion" )
@ResponseBody
public Map<String,Object> login( @RequestBody JSONObject jsonObj) {
System.out.println(jsonObj.toString());
Integer limit = jsonObj.getInteger("limit");
Integer offset = jsonObj.getInteger("offset");
QuestionVO parameters = new QuestionVO();
parameters.setLimit(limit);
parameters.setOffset(offset);
parameters.setName(jsonObj.getString("questionName").trim());
Map<String,Object> map = new HashMap<String,Object>();
System.out.println(parameters.getLimit());
System.out.println(parameters.getOffset());
List<QuestionVO> resultList = qstDao.queryQuestionByPage(parameters);
int count = qstDao.queryQuestionCount(parameters);
map.put("rows", resultList);
map.put("total",count);
return map;
}
<%--
查询按钮事件
--%>
function search()
{
$('#tableList').bootstrapTable("refresh");
}
<%--
初始化
--%>
$(function () {
//1.初始化Table
var tableInit = new TableInit();
tableInit.Init();
});
var TableInit = function () {
var oTableInit = new Object();
//初始化Table
oTableInit.Init = function () {
$('#tableList').bootstrapTable({
url: 'queryQuestion.action', //请求后台的URL(*)
queryParamsType: 'limit',
method: 'post', //请求方式(*)
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
pagination: true,
limit:10, //初始化加载第一页,默认第一页
offset: 0, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
height: 500, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
columns: [
{
field: 'id',
title: '编号'
},
{
field: 'type',
title: '类型'
},
{
field: 'name',
title: '问题'
},
{
field: 'content',
width:500,
title: '内容',
formatter:function(value,row,index){
var e = '呵呵';
return e;
}
},
{
field: 'content',
title: '删除',
formatter:function(value,row,index){
var e = '<a href="#" mce_href="#" onclick="edit(\''+ row.id + '\')">编辑</a> ';
return e;
}
}
],
queryParams: function (params) {
return {
questionName:$("#questionName").val(),
limit: params.limit,
offset: params.offset
}
},
});
};
return oTableInit;
}
------------后台
@RequestMapping(value = "/queryQuestion" )
@ResponseBody
public Map<String,Object> login( @RequestBody JSONObject jsonObj) {
System.out.println(jsonObj.toString());
Integer limit = jsonObj.getInteger("limit");
Integer offset = jsonObj.getInteger("offset");
QuestionVO parameters = new QuestionVO();
parameters.setLimit(limit);
parameters.setOffset(offset);
parameters.setName(jsonObj.getString("questionName").trim());
Map<String,Object> map = new HashMap<String,Object>();
System.out.println(parameters.getLimit());
System.out.println(parameters.getOffset());
List<QuestionVO> resultList = qstDao.queryQuestionByPage(parameters);
int count = qstDao.queryQuestionCount(parameters);
map.put("rows", resultList);
map.put("total",count);
return map;
}
相关文章推荐
- bootstrapTable--2.客户端分页
- bootstrapTable后端分页
- bootstrap table服务端实现分页
- bootstrap table 分页,客户端分页
- bootstrap 和 easyui在使用table分页的时候使用参数的异同
- Node.js中Bootstrap-table的两种分页的实现方法
- bootstrap的bootstrapTable分页查询如何扩展表单参数
- bootstrap-table分页问题
- BootStrap table 数据填充与分页
- bootstrap table 显示连续序号,分页有效
- BootStrap Table显示行号,并且分页后依然递增
- 基于Metronic的Bootstrap开发框架经验总结(16)-- 使用插件bootstrap-table实现表格记录的查询、分页、排序等处理
- BootStrap-table 客户端分页和服务端分页的区别
- Bootstrap-table插件先分页再搜索
- BootstrapTable去掉表格与分页的空白
- 基于bootstrap table分页数据及行内编辑和导出数据(一)
- BootStrap table 数据填充与分页应用总结
- bootstrap-table 分页的问题
- bootstrap table 分页例子
- spring data jpa bootstrap table 后端分页(详解)