PDA

View Full Version : TreePanel and scrollbars



raybeez
13 Jul 2009, 10:58 AM
Hi,

I'm trying to use a TreePanel and want it to behave such that it doesn't display any scrollbars unless necessary, but no matter what I set the panel width to (and despite all other efforts) its always rendered with an unnecessary horizontal scrollbar.

The Basic Tree demo does what I want, but even if I copy/paste the code from the demo website into my own entry point I still get a horizontal bar. Here's the code I'm using to test, any suggestions?



import com.extjs.gxt.samples.client.Examples;
import com.extjs.gxt.samples.resources.client.TestData;
import com.extjs.gxt.samples.resources.client.model.Folder;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

/*
* * Entry point classes define <code>onModuleLoad()</code>.
*/
public class TestProject implements EntryPoint {

/**
* This is the entry point method.
*/
public void onModuleLoad() {

Folder model = TestData.getTreeModel();

TreeStore<ModelData> store = new TreeStore<ModelData>();
store.add(model.getChildren(), true);

final TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
tree.setDisplayProperty("name");
tree.getStyle().setLeafIcon(Examples.ICONS.music());
tree.setWidth(350);

ButtonBar bar = new ButtonBar();
bar.add(new Button("Expand All", new SelectionListener<ButtonEvent>() {

public void componentSelected(ButtonEvent ce) {

tree.expandAll();
}
}));

bar.add(new Button("Collapse All", new SelectionListener<ButtonEvent>() {

public void componentSelected(ButtonEvent ce) {

tree.collapseAll();
}
}));

RootPanel.get().add(bar);
RootPanel.get().add(tree);

}
}
Which results in this:

http://i166.photobucket.com/albums/u111/rehbeez/th_TreePanel-1.png (http://s166.photobucket.com/albums/u111/rehbeez/?action=view&current=TreePanel-1.png)

engywook
20 Aug 2009, 11:49 AM
I'm having the exact same issue. Did you find a solution?

Edit: I just realized the scroll bar appears in the hosted browser, but not in Firefox 3.

Pietro Marrone
27 Aug 2009, 3:14 AM
I'm having the exact same issue. Did you find a solution?

Edit: I just realized the scroll bar appears in the hosted browser, but not in Firefox 3.


Not exactly on Firefox 3.0.13 on Ubuntu 9.04 the scrollbar still appears