bootstrap table 基础方法示例

$(function () {
    initialPage();
    getGrid();
});

function initialPage() {
    $(window).resize(function() {
        $('#dataGrid').bootstrapTable('resetView', {height: $(window).height()-56});
    });
}
var ino=0;
function getGrid() {
    $('#dataGrid').bootstrapTableEx({
        url: '../../student/list?_' + $.now(),
        height: $(window).height()-56,
        striped: true,
        showColumns:true,//表格列筛选
        queryParams: function(params){
            ino = (params.pageNumber-1)*params.pageSize+1;
            params.linkType = vm.linkType;
            params.enSchoolType = vm.enSchoolType;
            params.checkType = vm.checkType;
            params.househoSchdistrict = vm.househoDistrictId;
            params.houseSchdistrict = vm.houseDistrictId;
            params.houseType = vm.houseType;
            params.checkDateSort = vm.checkDateSort;
            params.keyword = vm.keyword;
            return params;
        },
        responseHandler:function(res){ // res为从服务器请求到的数据
            result=res;
           return res;
        },
        columns: [
        {checkbox: true},
            {field: "i", title: "序号", width: "3%",
                formatter: function () {
                    return ino++;
                }
            },
            {field : "name", title : "姓名", width : "5%"},
            {field : "idCardNo", title : "身份证号", width : "4%"},
            {field : "enSchoolType", title : "入学类型", width : "4%"},
            {field : "househoSchdistrictName", title : "户籍所属学区", width : "9%"},
            {field : "householdAddress", title : "户籍地址", width : "15%"},
            {field : "houseSchdistrictName", title : "房产所属学区", width : "10%"},
            {field : "houseAddress", title : "房产地址", width : "15%"},
            {field : "houseType", title : "房产类型", width : "9%"}},
            {field : "createDate", title : "提交时间", width : "10%"},
            {field : "checkedname", title : "审核人", width : "6%"},
            {field : "checkedDate", title : "审核时间", width : "7%"},
            {field : "isMeets", title : "审核状态", width : "4%",
              formatter:function(value,row){
              if(row.isChecking =="0"){
                if (row.isMeets == "1"){
                  return '<span class="label label-primary">待审核</span>';
                } else if (row.isMeets == "2"){
                  return '<span class="label label-danger">未通过</span>';
                } else if (row.isMeets == "3"){
                  return '<span class="label label-success">已通过</span>';
                } else if (row.isMeets == "5"){
                  return '<span class="label label-warning">挂起中</span>';
                } else if (row.isMeets == "9"){
                  return '<span class="label label-warning">冻结中</span>';
                }
              }else{
                return '<span class="label label-warning">审核中</span>';
              }
              }},
            {field: 'id',title: '操作', width: "3%", events: operateEvents,formatter:operateFormatter}
        ]
    })
}
function operateFormatter(value, row, index) {
    return [
        '<a class="checkStudent" href="javascript:void(0)" title="审核">',
        '审核',
        '</a>'
    ].join('');
}
window.operateEvents = {
    'click .checkStudent': function (e, value, row, index) {
      if(row.isChecking=="1"&&vm.user.userId!=row.checkedBy){
        dialogMsg("信息正在审核中,不能操作","error");
      }else{
        //打开相应审核页面
        openOnNewTab("base/student/check.html?id="+row.id,row.id,row.name);
      }
    }
};

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值