<zk>
<zscript><![CDATA[
import org.zkoss.zul.DefaultTreeModel;
import org.zkoss.zul.DefaultTreeNode;
DefaultTreeNode root = new DefaultTreeNode(null,
new DefaultTreeNode[] {
new DefaultTreeNode("item a"),
new DefaultTreeNode("item b", (DefaultTreeNode[])null),
new DefaultTreeNode("item c",
new DefaultTreeNode[] {
new DefaultTreeNode("item c1"),
new DefaultTreeNode("item c2")
})
}
);
DefaultTreeModel model1 = new DefaultTreeModel(root);
//@param emptyChildAsLeaf whether to treat the zero size of children node as a leaf node.
DefaultTreeModel model2 = new DefaultTreeModel(root, true);
]]></zscript>
<hlayout>
<tree model="${model1}" width="150px">
<template name="model">
<treeitem label="${each}" open="true"/>
</template>
</tree>
<tree model="${model2}" width="150px">
<template name="model">
<treeitem label="${each}" open="true"/>
</template>
</tree>
</hlayout>
</zk>