在使用easyui的DataGrid控件时,构建复合表头就显得非常简单了。只需要在使用columns属性时通过数组的方式编写列名即可。如我们需要构建成一个如下的表头:

EasyUI中DataGrid构建复合表头

Columns的代码如下:

columns: [[
                    { field: '_id', title: '行号', fixed: true, rowspan:2 },
                    { field: '_j', title: '铁路局', fixed: true, colspan:2 }
                ], [
                    { field: '_id', title: '京局', fixed: true },
                    { field: '_j', title: '哈局', fixed: true }
                ]
]

但是这里需要注意一点:DataGrid在构建复合表头时,合并单元格使用的colspan和rowspan的值一定要是数字,不能是字符。如

{ field: '_cj', title: '侧架', width: 20, colspan: 9 }

而不能是

{ field: '_cj', title: '侧架', width: 20, colspan: ‘9’ }

相关文章:

  • 2022-12-23
  • 2022-01-18
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2022-02-13
  • 2022-12-23
相关资源
相似解决方案