PDA

View Full Version : [FNR] TreePanel not scrolling correctly when using arrow keys



hhiplaz
27 Jul 2011, 10:42 AM
I'd be grateful for a workaround if somebody knows one.

Steps to reproduce:

1. run the code below which shows a tree
2. expand all tree nodes, including child nodes, so a vertical scroll bar appears
3. select the first node ("one")
4. hit the down arrow key
5. bug: the second node ("one one") is selected, but it scrolls out of sight.
6. now scroll down and select any leaf, for example "two one four".
7. keep hitting the arrow up key until you get to an inner node, for example "two one"
8. bug: the correct node is selected, but it is not visible because the tree doesn't scroll

I'm using GXT 2.2.4 in hosted mode on Mac OS X. I'm seeing this in Safari, FF, and Chrome. Not sure about other browsers.



public class Test implements EntryPoint {

public void onModuleLoad() {
ThemeManager.register(Slate.SLATE);
GXT.setDefaultTheme(Slate.SLATE, true);

TreeStore<Folder> store = new TreeStore<Folder>();
Folder f1 = new Folder("1", "one");
store.add(f1, false);
Folder f11 = new Folder("11", "one one");
store.add(f1, f11, false);
store.add(f11, new Folder("111", "one one one"), false);
store.add(f11, new Folder("112", "one one two"), false);
store.add(f11, new Folder("113", "one one three"), false);
store.add(f11, new Folder("114", "one one four"), false);
store.add(f11, new Folder("115", "one one five"), false);
store.add(f11, new Folder("116", "one one six"), false);
store.add(f11, new Folder("117", "one one seven"), false);
store.add(f11, new Folder("118", "one one eight"), false);
store.add(f11, new Folder("119", "one one nine"), false);
Folder f2 = new Folder("2", "two");
store.add(f2, false);
Folder f21 = new Folder("21", "two one");
store.add(f2, f21, false);
store.add(f21, new Folder("211", "two one one"), false);
store.add(f21, new Folder("212", "two one two"), false);
store.add(f21, new Folder("213", "two one three"), false);
store.add(f21, new Folder("214", "two one four"), false);
store.add(f21, new Folder("215", "two one five"), false);
store.add(f21, new Folder("216", "two one six"), false);
store.add(f21, new Folder("217", "two one seven"), false);
store.add(f21, new Folder("218", "two one eight"), false);
store.add(f21, new Folder("219", "two one nine"), false);
store.add(new Folder("3", "three"), false);

final TreePanel<Folder> pnlTree = new TreePanel<Folder>(store);
pnlTree.setDisplayProperty("name");
pnlTree.setSize(200, 200);

LayoutContainer con = new LayoutContainer() {
@Override
public void onRender(Element target, int index) {
super.onRender(target, index);
add(pnlTree);
}
};

con.add(pnlTree);
RootPanel.get("sendButtonContainer").add(con);
}
}




public class Folder extends BaseTreeModel {
private static final long serialVersionUID = 2525604102944798997L;

public Folder(String id, String name) {
set("id", id);
set("name", name);
}
}

sven
28 Jul 2011, 12:46 AM
This is fixed in SVN now as of revision 2416

hhiplaz
28 Jul 2011, 8:36 AM
Thanks!

Will this be in a future 2.x release, or 3.0 only?

sven
28 Jul 2011, 8:38 AM
It will be in a future 2.X release. 2.2.5 will be the first version that will contain this change

hhiplaz
28 Jul 2011, 8:47 AM
Herzlichen Dank für die rasche Antwort :)