View Full Version : Scrollbars inside a TabPanel
throttle
27 Nov 2008, 3:27 AM
I need to add to a TabPanel some tabs containing two panels: a breadcrumb and another panel that will contain a varying content.
I have a class extending TabItem in which i add a HorizontalPanel for the breadcrumb and a LayoutContainer with a CardLayout for the second panel. The second panel doesn't have a fixed size, so i'd need to use scrollbars to view the content.
The problem is that i'm unable to correctly show the scrollbars. I tried setting scrollbars to AUTO to the second panel but they're not showed at all, so i tried setting them to ALWAYS, but i can only see the vertical one (and only if i maximize the browser window), while the bottom one is out of sight.
What is wrong?
Thanks in advance
fother
27 Nov 2008, 4:05 AM
create a ContentPanel
add all components to contentPanel
set contentPanel scroll AUTO
add contentPanel to tabItem
throttle
28 Nov 2008, 5:17 AM
That way i would have a scrollbar for both the breadcrumb and the other panel, while i want the breadcrumb to remain visible even when scrolling the other.
throttle
1 Dec 2008, 1:16 AM
Here is an example of what my code looks like
package PanelsTest.client;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.CardLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class TestEntryPoint implements EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
TabPanel tabPanel = new TabPanel();
tabPanel.add(new TestTabItem());
Viewport view = new Viewport();
view.add(tabPanel);
RootPanel.get().add(view);
}
}
class TestTabItem extends TabItem{
public TestTabItem(){
setText("Test");
setClosable(true);
ContentPanel container = new ContentPanel();
container.setHeaderVisible(false);
HorizontalPanel upperPanel = new HorizontalPanel();
upperPanel.setHeight(35);
Text leftUpperText = new Text("upper");
Text rightUpperText = new Text("Panel");
upperPanel.add(leftUpperText);
upperPanel.add(rightUpperText);
ContentPanel lowerPanel = new ContentPanel();
CardLayout cardLayout = new CardLayout();
lowerPanel.setLayout(cardLayout);
lowerPanel.setScrollMode(Scroll.AUTO);
lowerPanel.add(new Text("lowerPanel"));
container.add(upperPanel);
container.add(lowerPanel);
add(container);
InnerContentPanel innerPanel = new InnerContentPanel();
lowerPanel.add(innerPanel);
cardLayout.setActiveItem(innerPanel);
}
}
class InnerContentPanel extends ContentPanel{
public InnerContentPanel(){
setHeight(2200);
setWidth(2200);
setHeaderVisible(false);
}
}the lowerPanel doesn't show the scrolling bars even if the inner panel is set as 2200x2200 in size... I'm not sure if i'm not understanding how the CardLayout works or if there is some other problem...
Any ideas?
Thanks
karacutey
2 Dec 2008, 4:00 PM
its dependent on the type of layout you are using. auto works for flow, i dont think i twill work for card unless you nest a content panel inside of the accordian layout, then you apply the auto scrool to the nested panel
kara
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.