url: '',
method: "get",
title: '工资明细列表',
loadMsg: '数据加载中,请稍候...',
nowrap: false,
pageSize: 50,
pageList: [50, 150, 300],
columns: column,
fitColumns: true,
singleSelect: true,
pagination: true,
width: "100%",
toolbar: toolbar,
sortOrder: "asc",
onLoadSuccess: function (data) {
$.tool.MergeEasyUiGrid("TableContainer", "Name,SalaryYear,SalaryMonth");
}
});
合并类:
$.tool.MergeEasyUiGrid = function (tableID, colList) {
var ColArray = colList.split(",");
var tTable = $("#" + tableID);
var TableRowCnts = tTable.datagrid("getRows").length;
var tmpA;
var tmpB;
var PerTxt = "";
var CurTxt = "";
var alertStr = "";
for (j = ColArray.length - 1; j >= 0; j--) {
PerTxt = "";
tmpA = 1;
tmpB = 0;
for (i = 0; i <= TableRowCnts; i++) {
if (i == TableRowCnts) {
CurTxt = "";
}
else {
CurTxt = tTable.datagrid("getRows")[i][ColArray[j]];
}
if (PerTxt == CurTxt) {
tmpA += 1;
}
else {
tmpB += tmpA;
tTable.datagrid("mergeCells", {
index: i - tmpA,
field: ColArray[j], //合并字段
rowspan: tmpA,
colspan: null
});
tTable.datagrid("mergeCells", { //根据ColArray[j]进行合并
index: i - tmpA,
field: "Ideparture",
rowspan: tmpA,
colspan: null
});
tmpA = 1;
}
PerTxt = CurTxt;
}
}
}