jquery_easyUI合并单元格实例
1,html代码部分
复制代码 代码示例:
<table id="dg" style="height:350px;z-index:-5555; " class="easyui-datagrid" rownumbers="true"
data-options="fitColumns: true,
iconCls: 'icon-edit',
scrollbarSize:0,
multiSort:true,
remoteSort:true,
pagination:false,
singleSelect:false,
onLoadSuccess:OnLoadSucc,
method: 'get'">
<thead>
<tr>
<th data-options="styler:gethand,field:'ORGNA_NAME',width:20,halign:'center',align:'left'">单位名称</th>
<th data-options="styler:gethand,field:'NIANYUE',width:10,halign:'center',align:'center'">结算期间</th>
<th data-options="styler:gethand,field:'DJ_TBS',width:10,halign:'center',align:'right'">台班数<br>(个)</th>
<th data-options="styler:gethand,field:'DJ_JSJE',width:10,halign:'center',align:'right'">结算金额<br>(元)</th>
<th data-options="styler:gethand,field:'USERCODE',width:16,halign:'center',align:'left',formatter: getQz">领导签字</th>
</tr>
</thead>
</table>
2,合并方法:
复制代码 代码示例:
function OnLoadSucc() {
var data=$("#dg").datagrid("getData");
var rows=data.rows.length;
if(rows>1){
$("#dg").datagrid('mergeCells',{
index: 0,
field: 'ORGNA_NAME',
colspan: 2,
align:'center'
});
}
}
说明:
index 第几行合并
field 合并的列元素名称
colspan 合并几个单元格