bootstrapTable demo
1.引入bootstrapTable 的js文件
<script src="static/common/bootstrap/js/dataTables/bootstrap-table.js"></script>
<script src="static/common/bootstrap/js/dataTables/bootstrap-table-zh-CN.js"></script>
2.声明bootstrapTable 的dom对象
<
table id=
"mDataTables" class=
"table table-striped table-bordered table-hover"></
table>
3.js编码
function createTable(){
$(
"#mDataTables").bootstrapTable(
'destroy');
$(
"#mDataTables").bootstrapTable({
url :
'admin/usermanager/page',
pagination :
true,
striped :
true,
search :
false,
sortOrder :
"asc",
queryParamsType :
'',
queryParams :
function(param){
var temp = {
pageNumber:param.pageNumber,
pageSize:param.pageSize,
name:$(
"#searchName").val(),
roleId:$(
"#groupSelect").val(),
parentId:
null,
sortName:
this.sortName,
sortOrder:
this.sortOrder,
};
return temp;
},
cache :
false,
pageNumber :
1,
pageSize :
10,
pageList : [
10,
30,
50 ,
100],
showColumns :
true,
showRefresh :
false,
uniqueId :
"id",
sidePagination :
"server",
dataType :
"json",
dataFiled :
"rows",
minimumCountColumns :
2,
clickToSelect :
false,
columns : [
{
field :
'check',
checkbox :
true,
align :
'center',
valign :
'middle'
},
{
title :
'账户',
field :
'name',
align :
'center',
valign :
'middle',
},
{
title :
'组域',
field :
'role',
align :
'center',
valign :
'middle',
},
{
title :
'名称',
field :
'loanCompanies.companyName',
align :
'center',
valign :
'middle'
},
{
title :
'创建时间',
field :
'createDate',
align :
'center',
valign :
'middle',
sortable :
true ,
width :
130,
},
{
title :
'更新时间',
field :
'updateDate',
align :
'center',
valign :
'middle',
sortable :
true ,
width :
130,
},
{
title :
'状态',
field :
'status',
align :
'center',
valign :
'middle',
},
{
title :
'操作',
field :
'operation',
align :
'center',
valign :
'middle',
width :
260
} ],
});
}