easyUI合并行的单元格

案例:onLoadSuccess: onLoadSuccess 方法设置合并单元格的方法。

  1. <table class="easyui-datagrid" title="Merge Cells for DataGrid" style="width:700px;height:250px"
  2. data-options="
  3. rownumbers: true,
  4. singleSelect: true,
  5. iconCls: 'icon-save',
  6. url: 'datagrid_data1.json',
  7. method: 'get',
  8. onLoadSuccess: onLoadSuccess
  9. ">
  10. <thead>
  11. <tr>
  12. <th data-options="field:'productid',width:100">Product</th>
  13. <th data-options="field:'itemid',width:80">Item ID</th>
  14. <th data-options="field:'listprice',width:80,align:'right'">List Price</th>
  15. <th data-options="field:'unitcost',width:80,align:'right'">Unit Cost</th>
  16. <th data-options="field:'attr1',width:240">Attribute</th>
  17. <th data-options="field:'status',width:60,align:'center'">Status</th>
  18. </tr>
  19. </thead>
  20. </table>
  21. <script type="text/javascript">
  22. function onLoadSuccess(data){
  23. var merges = [{
  24. index: 2,//从第三行开始合并
  25. rowspan: 2//合并2行
  26. },{
  27. index: 5,//从第六行开始合并
  28. rowspan: 2//合并2行
  29. },{
  30. index: 7,//从第8行开始合并
  31. rowspan: 2//合并2行
  32. }];
  33. for(var i=0; i<merges.length; i++){
  34. $(this).datagrid('mergeCells',{
  35. index: merges[i].index,
  36. field: 'productid',//productid合并的列字段(第一列)
  37. rowspan: merges[i].rowspan
  38. });
  39. }
  40. }
  41. </script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值