
精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
树形网格(TreeGrid)组件从数据网格继承,但是允许在行之间存在父/子节点关系。许多属性继承至数据网格,可以用在树形网格中。为了使用树形网格,用户必须定义 'treeField' 属性,指明哪个字段作为树节点。
<table id="test" title="Folder Browser" class="easyui-treegrid"style="width:400px;height:300px" url="data/treegrid_data.json" rownumbers="true" idField="id" treeField="name"> <thead> <tr> <th field="name" width="160">Name</th> <th field="size" width="60" align="right">Size</th> <th field="date" width="100">Modified Date</th> </tr> </thead> </table>
树形网格可以展示有限空间上带有多列和复杂数据电子表格。
<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>
如上所述,树形网格的使用和数据网格一样。请使用 'frozen' 属性来定义冻结列,列的 'colspan' 和 'rowspan' 属性来定义多行表头。