-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I try to migrate my very first ZK application to ZK 3.6.2 / 5.0RC. But (unlike the old 3.0.x version) the scroll to selected Treeitem doesn't work. After some research i could reproduce the problem:
There is no autoscroll (to the selectedItem) after the tree is rendered the first time. Check this demo:
The first output does not scroll to the bottom of the tree - but the last item is selected. The buttons works.
Tested with 3.5.0 Prof, 3.6.0 Std, 3.6.2 Prof, 5.0RC
I post a bug.
<window id="win" title="tree checkmark demo" border="normal" height="600px"> <zscript> Treeitem posItem1; Treeitem posItem2; void create() { for(int i=0; i != 45; i++) { Treeitem item = new Treeitem(); Treerow row = new Treerow(); Treecell cell = new Treecell(); cell.label = "Item " + i; row.appendChild(cell); item.appendChild(row); if (i==0) { posItem1 = item; } if (i==44) { posItem2 = item; // item.selected = true; // doesn't help } child.appendChild(item); } tree.selectedItem= posItem2; } </zscript> <button label="Pos1" onClick="tree.selectedItem = posItem1;"/> <button label="Pos2" onClick="tree.selectedItem = posItem2;" /> <separator bar="true" /> <tree id="tree" width="90%" vflex="true" checkmark="false" rows="20" onCreate="create()"> <treechildren id="child"> </treechildren> </tree> </window>
/Robert
BTW: My complex tree building is not rendered by 5.0RC - no error to see :-(
Hi,Robert
we don't design to autoscroll after rendered, it is not ours specification
you can use timmer to set selectedItem
//jimmy
Hi, i have finished my "autoscroll".
First i post this as bug, because it is a "lost" feature, because it works in older ZK Versions (i think it was 3.0.2).
However i solved the problem like your suggest with a timer.
Another issue: the tree has to known any height (pixel/rows), otherwise the autoscroll won't work correctly.
/Robert
Asked: 2009-10-13 23:56:35 +0800
Seen: 622 times
Last updated: Nov 03 '09