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-三种等待方式