首页 > 代码库 > BootStrap Table

BootStrap Table

 

在初始化table的时候,参数最好是直接取, 按照temp[key] = value;的方式会在进行分页等操作时沿用页面初始化的参数.

$(function () {
    //最大层级:2层
    initTable(2);
})

$(document).ready(function () {
    clearInputOnInit();

});

function clearInputOnInit() {
     ctlBeginTime.setValue("2016-12-01 00:00:00");
     ctlEndTime.setValue("2016-12-21 00:00:00");
}

function initTable(level) {
    var columns = [];

    $(‘#tabAudit‘).bootstrapTable({
        columns: columns,
        url: "/Business/FinancialManage/Biz_Audit_ProduceTask/LoadAuditProduceTaskFrist",
        queryParams: function (params) {
            var temp = {
                limit: params.limit,
                offset: params.offset,
                order: params.order,
                ordername: params.sort,
                beginTime: ctlBeginTime.getValue(),
                endTime: ctlEndTime.getValue()
            };
            //$.each(query, function (key, value) {
            //    temp[key] = value;
            //});
            return temp;
        },
        method: ‘get‘,
        striped: true,
        pagination: true,
        sortName: "序号",
        sortOrder: "desc",
        sidePagination: "server",
        cache: false,
        pageNumber: 1,
        pageSize: 10,
        pageList: [5, 10, 20, 50, 100, 200],
        smartDisplay: false,
        rowStyle: function (row, index) {
            //颜色样式[‘active‘, ‘success‘, ‘info‘, ‘warning‘, ‘danger‘];
            var strclass = "";
            if (row.ORDER_STATUS == "已审核") {
                strclass = ‘success‘;
            }
            else {
                return {};
            }
            return { classes: strclass }
        },
        detailView: true,
        onExpandRow: function (index, row, $detail) {
            expandTable($detail, level - 1, row);
        }
    });
}

 table指定高度之后,在IE下有列头内容无法对齐的问题

技术分享

技术分享

 

BootStrap Table