bootstrap-table基本应用

参考资料:
http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/

<table data-toggle="table" id="table" data-toolbar="#toolbar" data-single-select="true"
data-click-to-select="true">
<thead>
<tr class="info">
<th data-checkbox="true"></th>
<th data-field="empid" data-visible="false">id</th>
<th data-field="列字段,与后台查询出来的要对应">列说明</th>
</tr>
</thead>
</table>


function initTable(url, tableId) {
$table = $('#'+tableId);
$table.bootstrapTable('destroy');
$table.bootstrapTable({
url: url,
method: 'post',
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
pagination: true,
pageNumber: staticObj.pageNumber,
pageSize: staticObj.pageSize,
pageList: [10, 25, 50, 100],
//分页方式:client客户端分页,server服务端分页(*)
sidePagination: "server",
/*默认值为 'limit' ,在默认情况下 传给服务端的参数为:offset,limit,sort
设置为 '' 在这种情况下传给服务器的参数为:pageSize,pageNumber*/
//queryParamsType: '',
//查询参数,每次调用是会带上这个参数,可自定义。若设置此参数,则不能自动传offset和limit参数
/*queryParams: function(params) {
//var subcompany = $('#subcompany option:selected').val();
return {
//pageNumber: params.offset,
//pageSize: params.limit
//companyId:subcompany,
};
},*/
/*data: data*/
});
}

分页的话后台一定要接收这两个参数

private Integer offset;
private Integer limit;



@Action(value="findAll", results={@Result(name = "json" , type="json", params={"root","map"})})
public String findAll(){
List<EmployeeEntity> list = service.findAll();
map = new HashMap();
map.put("total",service.count()); //数据总数
map.put("rows",list); //分页后的数据

return "json";
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值