<table id="table"
data-toggle="table"
data-striped ="true" --条纹
data-pagination ="true" --分页
data-side-pagination = "server" --服务器端分页 ('client' 客户端)
data-show-header ="true" --显示表头
data-show-footer = "false" --显示表尾部
data-search = "false" --工具栏 查询框
data-strict-search = "false" --精确查询
data-search-text = "" --查询框初始值
data-search-time-out = "500" --查询timeout时间
data-trim-on-search = "true" --去掉查询参数空格
data-show-columns ="true" --工具栏 显示表头信息 可以调整显示行
data-minimum-count-columns = "1" -- data-show-columns 选项最小显示1列
data-show-refresh = "true" --工具栏 显示刷新按钮
data-show-toggle ="true" --工具栏 转换表格为列表显示
data-card-view = "false" --显示为列表
data-smart-display ="false" --显示分页或列表
data-query-params-type = ""
data-query-params = "queryParams"
data-page-size = "10"
data-page-number = "1"
data-page-list = "[10, 25, 50, 100, 200]"
data-response-handler = "responseHandler"
data-url="${syspath}/list">
<thead>
<tr>
<th data-formatter="indexFormatter">序列</th>
<th data-field="javabean attribute">返回实体的属性</th>
<th data-formatter="actionFormatter"> </th>
</tr>
</thead>
</table>
function indexFormatter(value, row, index) {
return '序列'+(index+1);
}
function actionFormatter(value, row, index) {
return [
'<a href="path?id='+row.id+'"><span>编辑</span></a>',
'<a onClick="del('+row.valid+','+row.id+')" href="javascript:;"><span>删除</span></a>'
].join(' ');
}
function del(valid,id){
//删除
}
function responseHandler(res) {
if(res.total > 0) {
return {
"rows": res.rows,
"total": res.total
}
} else {
return {
"rows": [],
"total": 0
}
}
}
function queryParams(params) {
return {
pageSize: params.pageSize,
pageNumber: params.pageNumber,
xx: $("#控件").val()
};
}
controller
@RequestMapping("/list")
@ResponseBody
public BootTablePagEntity<entity> paglist(HttpServletRequest request) {
//request.getParameter("pageSize/pageNumber/xx");
return service.getList(HttpUtil.getRequestToMap(request));//获取分页数据
}
实体类
public class BootTablePagEntity<T> implements Serializable {
private static final long serialVersionUID = -4161680222399055222L;
private int total; //对应页面总条数
private List<T> rows; //对应页面结果集
}
转载于:https://my.oschina.net/weaponking/blog/647393