读书人

easyUI 创造复杂TreeGrid

发布时间: 2012-09-10 11:02:32 作者: rapoo

easyUI 创建复杂TreeGrid

@author YHC

TreeGrid可以展示电子表格在多列和复杂的数据在有限的空间,这个教程将演示如何将表格数据排列在分割的grid中和多表头允许你组织共同的数据.

easyUI 创造复杂TreeGrid

查看 Demo

创建 TreeGrid
<table title="Complex TreeGrid" class="easyui-treegrid" style="width:550px;height:250px"          url="data/treegrid2_data.json"          rownumbers="true" showFooter="true"          idField="id" treeField="region">      <thead frozen="true">          <tr>              <th field="region" width="150">Region</th>          </tr>      </thead>      <thead>          <tr>              <th colspan="4">2009</th>              <th colspan="4">2010</th>          </tr>          <tr>              <th field="f1" width="50" align="right">1st qrt.</th>              <th field="f2" width="50" align="right">2st qrt.</th>              <th field="f3" width="50" align="right">3st qrt.</th>              <th field="f4" width="50" align="right">4st qrt.</th>              <th field="f5" width="50" align="right">1st qrt.</th>              <th field="f6" width="50" align="right">2st qrt.</th>              <th field="f7" width="50" align="right">3st qrt.</th>              <th field="f8" width="50" align="right">4st qrt.</th>          </tr>      </thead>  </table>  
正如你所看见的,treegrid 的使用和datagrid一样,使用frozen属性定义冻结列,列的 'colspan' 和'rowspan' 属性定义多行表头.

下载 EasyUI 示例代码:easyui-treegrid-demo.zip




读书人网 >编程

热点推荐