📄 b35-2149511.zul
字号:
<?xml version="1.0" encoding="UTF-8"?><!--B35-2149511.zul{{IS_NOTE Purpose: Description: History: Tue Oct 7 09:02:04 2008, Created by jumperchen}}IS_NOTECopyright (C) 2008 Potix Corporation. All Rights Reserved.{{IS_RIGHT}}IS_RIGHT--><zk xmlns="http://www.zkoss.org/2005/zul" xmlns:h="http://www.w3.org/1999/xhtml"><window> <h:ol> <h:li>Open 'Item 1.a'</h:li> <h:li>Open 'Item 2.a' and 'Item 3.a'</h:li> <h:li>Scroll down to '23.A' and open it - notice that the tree has scrolled to top(That is wrong)</h:li> </h:ol> <zscript><![CDATA[ int counter = 3; EventListener aa = new EventListener() { public void onEvent(Event event) { autoAdd( event.target ); } }; void autoAdd(Treeitem parent) { if ( parent.empty ) { parent.removeEventListener( "onOpen", aa ); for (int i=0; i < 10; i++) { Treeitem ti = new Treeitem(); Treerow tr = new Treerow(); String c = Integer.toString( ++counter ); tr.appendChild( new Treecell( c + ".A" ) ); tr.appendChild( new Treecell( c + ".B" ) ); tr.appendChild( new Treecell( c + ".C" ) ); tr.appendChild( new Treecell( c + ".D" ) ); ti.appendChild( tr ); parent.treechildren.appendChild( ti ); ti.setOpen(false); ti.setTooltiptext( "Node " + c ); ti.addEventListener( "onOpen", aa ); ti.appendChild( new Treechildren() ); } } } ]]></zscript> <tree id="tree" pageSize="-1" rows="20" > <treecols> <treecol label="A" /> <treecol label="B" /> <treecol label="C" /> <treecol label="D" /> </treecols> <treechildren> <treeitem open="false" onOpen="if (event.open) autoAdd(self)"> <treerow> <treecell label="Item 1.a" /> <treecell label="Item 1.b" /> <treecell label="Item 1.c" /> <treecell label="Item 1.d" /> </treerow> <treechildren> <treeitem open="false" onOpen="if (event.open) autoAdd(self)"> <treerow> <treecell label="Item 2.a" /> <treecell label="Item 2.b" /> <treecell label="Item 2.c" /> <treecell label="Item 2.d" /> </treerow> <treechildren /> </treeitem> <treeitem open="false" onOpen="if (event.open) autoAdd(self)"> <treerow> <treecell label="Item 3.a" /> <treecell label="Item 3.b" /> <treecell label="Item 3.c" /> <treecell label="Item 3.d" /> </treerow> <treechildren /> </treeitem> </treechildren> </treeitem> </treechildren> </tree> </window></zk>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -