Tree Template
From Documentation
This article is out of date, please refer to https://docs.zkoss.org/zk_dev_ref/ for more up to date information.
Similar to Listbox, you can also define a customer rendering with a template for a tree:
<tree model="${files}">
<treecols>
<treecol label="Path"/>
<treecol label="Description"/>
</treecols>
<template name="model">
<treeitem context="menupopup">
<treerow>
<treecell label="${each.data.path}"/>
<treecell label="${each.data.description}"/>
</treerow>
</treeitem>
</template>
</tree>
assume files is an instance of DefaultTreeModel. Notice since DefaultTreeModel is used, each references an instance of DefaultTreeNode. Thus, to retrieve the real data, use DefaultTreeNode.getData()
Version History
| Version | Date | Content |
|---|---|---|
| 6.0.0 | July 2011 | The template feature was introduced. |