easyUI合并行的单元格
2015-09-08 17:15
411 查看
案例:onLoadSuccess: onLoadSuccess 方法设置合并单元格的方法。
<table
class="easyui-datagrid"
title="Merge Cells for DataGrid"
style="width:700px;height:250px"
data-options="
rownumbers: true,
singleSelect: true,
iconCls: 'icon-save',
url: 'datagrid_data1.json',
method: 'get',
onLoadSuccess: onLoadSuccess
">
<thead>
<tr>
<th
data-options="field:'productid',width:100">Product</th>
<th
data-options="field:'itemid',width:80">Item
ID</th>
<th
data-options="field:'listprice',width:80,align:'right'">List
Price</th>
<th
data-options="field:'unitcost',width:80,align:'right'">Unit
Cost</th>
<th
data-options="field:'attr1',width:240">Attribute</th>
<th
data-options="field:'status',width:60,align:'center'">Status</th>
</tr>
</thead>
</table>
<script
type="text/javascript">
function onLoadSuccess(data){
var merges
=
[{
index:
2,//从第三行开始合并
rowspan:
2//合并2行
},{
index:
5,//从第六行开始合并
rowspan:
2//合并2行
},{
index:
7,//从第8行开始合并
rowspan:
2//合并2行
}];
for(var
i=0; i<merges.length;
i++){
$(this).datagrid('mergeCells',{
index: merges[i].index,
field:
'productid',//productid合并的列字段(第一列)
rowspan: merges[i].rowspan
});
}
}
</script>
<table
class="easyui-datagrid"
title="Merge Cells for DataGrid"
style="width:700px;height:250px"
data-options="
rownumbers: true,
singleSelect: true,
iconCls: 'icon-save',
url: 'datagrid_data1.json',
method: 'get',
onLoadSuccess: onLoadSuccess
">
<thead>
<tr>
<th
data-options="field:'productid',width:100">Product</th>
<th
data-options="field:'itemid',width:80">Item
ID</th>
<th
data-options="field:'listprice',width:80,align:'right'">List
Price</th>
<th
data-options="field:'unitcost',width:80,align:'right'">Unit
Cost</th>
<th
data-options="field:'attr1',width:240">Attribute</th>
<th
data-options="field:'status',width:60,align:'center'">Status</th>
</tr>
</thead>
</table>
<script
type="text/javascript">
function onLoadSuccess(data){
var merges
=
[{
index:
2,//从第三行开始合并
rowspan:
2//合并2行
},{
index:
5,//从第六行开始合并
rowspan:
2//合并2行
},{
index:
7,//从第8行开始合并
rowspan:
2//合并2行
}];
for(var
i=0; i<merges.length;
i++){
$(this).datagrid('mergeCells',{
index: merges[i].index,
field:
'productid',//productid合并的列字段(第一列)
rowspan: merges[i].rowspan
});
}
}
</script>
相关文章推荐
- java.lang.IllegalArgumentException: addChild: Child name '/SSHE' is not unique
- Caused by: java.lang.IllegalArgumentException: addChild: Child name 'localhost' is not unique
- confluence 配置
- UITableView topview渐变的效果
- UIScrollView
- 如何隐藏UITableView中底部多余的空白行
- DuiLib响应按钮事件
- DuiLib响应按钮事件
- easyUI的行内编辑editor
- iOS UIActivityIndicatorView
- UI 设计师提供 iOS 字体和长度应当用什么单位
- UITableViewCell与cell之间的那条线
- StringBuilder与StringBuffer的区别(转)
- easyUI中的datagrid的formatter方法中 使用$.ajax()方法绑定多个不同数据源的数据
- DelayQueue Demo
- NYOJ 686 An Interesting Sequence 【欧拉函数】
- 十大滤波算法程序大全(Arduino精编无错版)(转)
- The server quit without updating PID file (/var/run/mysqld/mysqld.pid). ...
- Reinstall the Arduino Pro Mini Bootloade ISP(转)
- Arduino中hex文件的保存及应用(转)