最近在学bootStrap ,学的我头都大了,刚刚解决了个bootStrap的table的组件,就想来分享下,方便自己日后查阅,也看能不能让你们学的轻松点。。
首先贴上官网的自夸:
BootStrap Table是基于 Bootstrap 的 jQuery 表格插件,通过简单的设置,就可以拥有强大的单选、多选、排序、分页,以及编辑、导出、过滤(扩展)等等的功能。
不过倒也确实厉害,很好看!
接着贴出我弄的效果图:
是不是贼好看呢。。嘿嘿
接下来进入正题吧!!
*这里,为了好看,我加了面板
下面直接贴出我的js代码
*以上部分注释来自bootstrap-table官方文档:点击打开链接
四、给出我的json数据格式:
{
"page": 1,
"rows": [
{
"dept": {
"deptDesc": "",
"deptno": 10,
"dname": "销售部"
},
"loginName": "lisi",
"loginPwd": "456",
"realName": "李四",
"userId": 3,
"userStatus": "0"
},
{
"dept": {
"$ref": "$.rows[0].dept"
},
"loginName": "wangwu",
"loginPwd": "789",
"realName": "王五",
"userId": 4,
"userStatus": "0"
},
{
"dept": {
"$ref": "$.rows[0].dept"
},
"loginName": "zhaoliu",
"loginPwd": "111",
"realName": "赵六",
"userId": 5,
"userStatus": "0"
},
{
"dept": {
"deptno": 20,
"dname": "华南区域"
},
"loginName": "fanqi",
"loginPwd": "222",
"realName": "范七",
"userId": 6,
"userStatus": "0"
},
{
"dept": {
"$ref": "$.rows[3].dept"
},
"loginName": "maoba",
"loginPwd": "333",
"realName": "毛八",
"userId": 7,
"userStatus": "0"
}
],
"total": 11
}
public class TableSplitResult implements Serializable{
private Integer page;
private Integer total;
private T rows;
public TableSplitResult() {
}
public TableSplitResult(Integer page, Integer total, T rows) {
this.page = page;
this.total = total;
this.rows = rows;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public T getRows() {
return rows;
}
public void setRows(T rows) {
this.rows = rows;
}
}
$(".pull-right").css("display", "block");
因为我配置完成并显示数据的时候数据是分页了,但是分页条一直没显示不出来审查元素后发现它的display竟然等于none!