1、table表格合併
tables.dtGridColumns = [
{id: 'schoolName', title: '學校', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'eq',rowspan:'2'},
{id: 'originalNewMoney', title: '正價新籤', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk', colspan:'4', coltitle:'淨收入'},
{id: 'originalRenewalMoney', title: '正價續費', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk'},
{id: 'specialMoney', title: '特價', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk'},
{id: 'totalMoney', title: '總計', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk'},
{id: 'originalNewRegister', title: '正價新籤', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk', colspan:'3', coltitle:'訂單數'},
{id: 'originalRenewalRegister', title: '正價續費', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk'},
{id: 'specialRegister', title: '特價', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk'},
{id: 'studentCount', title: '在讀人數', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'eq',rowspan:'2'},
{id: 'personTimeCount', title: '在讀人次', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'eq',rowspan:'2'},
{id: 'originalCarryoverHour', title: '正價已結轉', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk', colspan:'2', coltitle:'小時數'},
{id: 'specialCarryoverHour', title: '特價已結轉', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk'},
{id: 'confirmIncome', title: '確認金額', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk', colspan:'2', coltitle:'結轉金額'},
{id: 'fcMoney', title: '實際結轉', type: 'string', columnClass: 'text-center', fastQuery:true, fastQueryType:'lk'}
];
效果
2、表格結尾增加合計(總計)行
//定義dtGridOption屬性中加入totalCountColById
tables.dtGridOption = {
lang: 'zh-cn',
ajaxLoad: true,
check: false,
loadURL: ctx + '',
exportFileName: '在冊人數以及庫存課時統計',
columns: tables.dtGridColumns,
gridContainer: 'tb_main_body',
toolbarContainer: 'tb_main_tool',
tools: 'refresh|faseQuery|export[excel,pdf,]|print',
totalCountColById:['xx','xx'], // 總計id字段
pageSize: 10,
pageSizeLimit: [10, 20, 50, 100, 500]
};
3、全部導出配置
①在初始化參數中配置
grid.diyparameters = { //參數
"exportOfQueryFlag" : "exportClassReadingRepay" // 值爲後臺給定值
};
②在search搜索方法中加入參數
search: function () {
grid.diyparameters = new Object();
grid.diyparameters.exportOfQueryFlag = "exportClassReadingRepay"; //導出全部hash 值
grid.refresh(true);
}
4、dtGrid跳轉到指定頁數
因爲沒找到有參數傳遞,然後看到js文件中寫死的,所以做一點改變
找到jquery.dtGrid.js文件,在它的load方法中修改,記得給方法加上pageType參數
修改前:
dtGridReflectionObj.pager.nowPage = 1;
修改後:
dtGridReflectionObj.pager.nowPage = pageType ? pageType : 1;
然後在調用load的時候傳入參數就行,親測有效。
5、dtGrid表格左側固定
增加下列屬性到dtGridOption中即可
tables.dtGridOption = {
lang:'zh-cn',
freezecol: 6,
freezerow:''
}