在初始化table的時候,參數最好是直接取, 按照temp[key] = value;的方式會在進行分頁等操做時沿用頁面初始化的參數.bootstrap
參數傳入可使用 queryParams 對象ide
$(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); } }); }