Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1397

DefaultTreeNode support empty children mean leaf node

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.0.3, 5.0.12, 6.5.1
    • None
    • Components
    • None
    • None

      <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>
      

            jimmyshiau jimmyshiau
            jimmyshiau jimmyshiau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: