创建复杂树形网格


树形网格(TreeGrid)可以展示有限空间上带有多列和复杂数据电子表格。本教程将演示如何将表格数据排列在分割的网格和多行表头中,以便组织共同的数据。

创建树形网格(TreeGrid)

  1. <table title="Complex TreeGrid" class="easyui-treegrid" style="width:550px;height:250px"
  2. url="data/treegrid2_data.json"
  3. rownumbers="true" showFooter="true"
  4. idField="id" treeField="region">
  5. <thead frozen="true">
  6. <tr>
  7. <th field="region" width="150">Region</th>
  8. </tr>
  9. </thead>
  10. <thead>
  11. <tr>
  12. <th colspan="4">2009</th>
  13. <th colspan="4">2010</th>
  14. </tr>
  15. <tr>
  16. <th field="f1" width="50" align="right">1st qrt.</th>
  17. <th field="f2" width="50" align="right">2st qrt.</th>
  18. <th field="f3" width="50" align="right">3st qrt.</th>
  19. <th field="f4" width="50" align="right">4st qrt.</th>
  20. <th field="f5" width="50" align="right">1st qrt.</th>
  21. <th field="f6" width="50" align="right">2st qrt.</th>
  22. <th field="f7" width="50" align="right">3st qrt.</th>
  23. <th field="f8" width="50" align="right">4st qrt.</th>
  24. </tr>
  25. </thead>
  26. </table>

正如您所看到的,树形网格(Treegrid)的使用和数据网格(Datagrid)一样。请使用 'frozen' 属性来定义冻结列,列的 'colspan' 和 'rowspan' 属性来定义多行表头。

下载 jQuery EasyUI 实例

下载地址