SpingBoot-Thymeleaf-bootstrapTable-分页之H5
H5
//初始化页数
$('#userListTable')
.bootstrapTable(
{
url : 'sys/user-list.json',
method : 'post', //请求方式()
dataType : 'json',
contentType : "application/x-www-form-urlencoded",
showExport : true, //是否显示导出按钮
exportDataType : "all", //basic'导出当前页, 'all'导出全部, 'selected'导出选中项.
toolbar : '#toolbar', //工具按钮用哪个容器
undefinedText : "-",//当数据为 undefined 时显示的字符
striped : true, //是否显示行间隔色
cache : false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性()
pagination : true, //是否显示分页()
pageSize : 5, //每页显示的记录数
pageNumber : 1, //当前第几页
pageList : [5,10, 15, 20, 25 ], //记录数可选列表
sortable : false, //是否启用排序
sortOrder : "asc", //排序方式
sidePagination : "server", //分页方式:client客户端分页,server服务端分页()
查询参数,每次调用是会带上这个参数,可自定义
queryParams : queryParams,
search : false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch : true,
showColumns : true, //是否显示所有的列
showRefresh : true, //是否显示刷新按钮
minimumCountColumns : 4, //最少允许的列数
responseHandler : responseHandler,
//clickToSelect: true, //是否启用点击选中行
//height: 600, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
uniqueId : "id", //每一行的唯一标识,一般为主键列
showToggle : true, //是否显示详细视图和列表视图的切换按钮
cardView : false, //是否显示详细视图
detailView : false, //是否显示父子表
columns : [
{
checkbox : true,
formatter: function (i,row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
if($.inArray(row.id,overAllIds)!=-1){// 因为 判断数组里有没有这个 id
return {
checked : true // 存在则选中
}
}
}
},
{
field : 'id',
title : 'ID',
visible : false
},
{
field: 'avatar',
title: '头像',
align: 'center',
formatter: function(value,row,index){
var imgUrl='files/'+row.avatar;
if(row.avatar==''||row.avatar==null){imgUrl="/images/default.jpg";}
return '<img src='+imgUrl+' class="img-rounded" style="width:50px;height:50px;" >';
}
},
{
field : 'loginName',
title : '登录名称'
},
{
field : 'userName',
title : '真实名称'
转载于:https://blog.51cto.com/360douruanliang/2107778
总结
以上是生活随笔为你收集整理的SpingBoot-Thymeleaf-bootstrapTable-分页之H5的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: WPFToolkit DataGrid
- 下一篇: Selenium-三种等待方式