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

DefaultTreeNode support empty children mean leaf node

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0.3, 5.0.12, 6.5.1
    • Component/s: Components
    • Labels:
      None

      Description

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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: