-
Bug
-
Resolution: Fixed
-
Normal
-
6.0.0
-
None
-
tested in zk6
cannot select a node if it doesn't open
<window> <zscript><![CDATA[//@DECLARATION class MyTreeNode extends org.zkoss.zul.DefaultTreeNode { boolean open; public MyTreeNode(String data, MyTreeNode[] children) { super(data,children); } public MyTreeNode(String data) { super(data); } } ]]></zscript> <zscript><![CDATA[ MyTreeNode root = new MyTreeNode("Root", new MyTreeNode[] {}); String[] labs = new String[]{"A","B","C"}; for (int i = 0; i < 3; i++) { MyTreeNode ni = new MyTreeNode(labs[i] + i,new MyTreeNode[] {}); for (int j = 0; j < 3; j++) { MyTreeNode nj = new MyTreeNode(ni.getData() + "-" + j, new MyTreeNode[] {}); for (int k = 0; k < 2; k++) { MyTreeNode nk = new MyTreeNode( nj.getData() + "-" + k); nj.add(nk); } ni.add(nj); } root.add(ni); } org.zkoss.zul.DefaultTreeModel model = new org.zkoss.zul.DefaultTreeModel(root); ]]></zscript> <tree id="tree" model="${model}" width="500px"> <treecols> <treecol label="name"/> </treecols> <template name="model" > <treeitem value="${each}"> <treerow> <treecell label="${each.data}"/> </treerow> </treeitem> </template> </tree> <hbox> <button label="select 1" onClick="tree.getModel().addSelectionPath(new int[]{1})" /> <button label="select 1,1" onClick="tree.getModel().addSelectionPath(new int[]{1,1})" /> <button label="select 1,1,1" onClick="tree.getModel().addSelectionPath(new int[]{1,1,1})" /> </hbox> </window>