Hybrid View

  1. #1
    Ext User
    Join Date
    May 2008
    Posts
    3
    Vote Rating
    0
    ricardocampos is on a distinguished road

      0  

    Default [FIXED] ContentPanel.setTopComponent() & ContentPanel.setBottomComponent() combined

    [FIXED] ContentPanel.setTopComponent() & ContentPanel.setBottomComponent() combined


    Hi!

    There seems to be a layout problem when I use ContentPanel.setTopComponent() & ContentPanel.setBottomComponent() at the same time... Shouldn't it be possible to do it?

    Example:

    ...
    ContentPanel panel =
    new ContentPanel();
    panel.setHeading(
    "Tasks");
    panel.setFrame(
    true);
    panel.setSize(700, 300);
    panel.setPagePosition(100, 100);
    panel.setLayout(
    new FitLayout());
    panel.setShadow(
    true);
    panel.setTopComponent(loadTopToolBar());
    panel.add(loadTable());

    panel.setBottomComponent(loadBottomToolBar());
    ...

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    You should be able to use both. This code works fine with beta 4:

    Code:
      public void onModuleLoad() {
        ContentPanel cp = new ContentPanel();
        cp.setFrame(true);
        cp.setSize(500, 400);
        cp.setLayout(new FitLayout());
        
        LayoutContainer c = new LayoutContainer();
        c.setBorders(true);
        cp.add(c);
        
        cp.setTopComponent(new ToolBar());
        cp.setBottomComponent(new ToolBar());
        
        RootPanel.get().add(cp);
      }
    When posting code, it is helpful if the code sample is complete and can be executed.

  3. #3
    ExtJS Premium Member
    Join Date
    Feb 2010
    Location
    Neptune Beach, Florida
    Posts
    50
    Vote Rating
    1
    gbegley is on a distinguished road

      0  

    Lightbulb Subclasses of ContentPanel must add top/bottom components prior to super.onRender()

    Subclasses of ContentPanel must add top/bottom components prior to super.onRender()


    I had a bit of trouble extending content panel with top and bottom components and came to the realization that top and bottom components cannot be set after the parent class's onRender has been called. The solution was simply to add top/bottom components prior to calling the super method.
    Code:
    public class MyPagingToolContent extends ContentPanel {
        
        ToolBar toolBar = new ToolBar();
        PagingToolBar pagingToolBar = new PagingToolBar(50);
    
    @Override
        protected void onRender(Element parent, int pos) {
            setTopComponent(toolBar); 
            setBottomComponent(pagingToolBar);
            super.onRender(parent, pos);
            setupTools();
            setFrame(true);
            setLayout(new FillLayout());
    
        }
    }

Thread Participants: 2