easyui 合并单元格
来源:互联网 发布:手写笔画图软件 编辑:程序博客网 时间:2024/05/21 22:50
1.合并方法
/*** EasyUI DataGrid根据字段动态合并单元格* 参数 tableID 要合并table的id* 参数 colList 要合并的列,用逗号分隔(例如:"name,department,office");*/function mergeCellsByField(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; } }}
2.调用合并方法
//呈现列表数据 $('#List').datagrid({ pagination: true, onLoadSuccess: function (data) { if (data.rows.length > 0) { //调用mergeCellsByField()合并单元格 mergeCellsByField("tbList", "No"); } } });
说明:
mergeCellsByField(tableID, colList) ;
参数 tableID 要合并table的id
参数 colList 要合并的列,用逗号分隔(例如:”name,department,office”);
这种方法一般情况下都不会用,因为合并出来的不美观
阅读全文
0 0
- easyUI合并DataGrid单元格
- easyui 合并单元格
- easyui datagrid合并单元格
- easyUI完美合并单元格
- easyui 合并单元格
- easyui 合并单元格
- easyUI 动态合并单元格
- easyUI(1)-------合并单元格
- easyui 单元格合并
- easyui 单元格合并
- easyui-datagrid 合并单元格
- easyui 合并单元格
- easyui动态合并单元格
- easyui datagrid 单元格合并
- jQuery EasyUI 合并表头单元格
- easyui datagrid 动态合并单元格
- EasyUI Datagrid 动态合并单元格
- EasyUI-datagrid-自动合并单元格
- 37行代码实现一个简单的打游戏AI
- C++文件读写详解(ofstream,ifstream,fstream)
- 代码大全-创建子程序的理由总结
- 六、Matlab 之 绘图操作(下)
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'shiroFilter' 错误解决办法
- easyui 合并单元格
- java实现自动生成多级目录
- 之前一直在找字典是如何封装的,一直找不到,自己就试着封装了个字典(Dictionary)
- Linux 查看服务器开放的端口号
- Leetcode 738. Monotone Increasing Digits
- 第一次写博客
- 面试编程题5:实现字符串翻转并输出
- test
- Python基础语法-常量与变量