1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    13
    Vote Rating
    0
    doud is on a distinguished road

      0  

    Default add and remove ContentPanel at runtime in BorderLayout

    add and remove ContentPanel at runtime in BorderLayout


    Is it possible to do something like
    Code:
    ContentPanel cp = new ContentPanel();
    cp.setLayout(new BorderLayout());
    
    LayoutContainer lc = new LayoutContainer();
    BorderLayoutData bld = new BorderLayoutData(LayoutRegion.CENTER);
    
    cp.add(lc, bld);
    at runtime

    Code:
    lc.removeFromParent();
    cp.add(new LayoutContainer(), new BorderlayoutData(LayoutRegion.CENTER);
    ?

  2. #2
    Ext User
    Join Date
    May 2008
    Posts
    27
    Vote Rating
    0
    Daniel Kurka is on a distinguished road

      0  

    Default


    you dont need to remove the panel from the center.

    Add a dummy Panel to the center with header visibility to false and use removeAll and add to switch content.

    Code:
    ContentPanel cp = new ContentPanel();
    cp.setLayout(new BorderLayout());
    
    LayoutContainer lc = new ContentPanel();
    lc.setHeaderVisibility(false);
    BorderLayoutData bld = new BorderLayoutData(LayoutRegion.CENTER);
    
    cp.add(lc, bld);
    at runtime:

    Code:
    lc.removeAll();
    cp.add(new ContentPanel());
    lc.layout();

    greetings
    daniel

  3. #3
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    2
    gslender is on a distinguished road

      0  

    Default


    ...or if you are switching between content on the panel, use a cardpanel and it will pop between the contentpanels (or whatever widget you add) http://extjs.com/deploy/gxtdocs/com/...CardPanel.html

  4. #4
    Ext User
    Join Date
    Jul 2008
    Posts
    13
    Vote Rating
    0
    doud is on a distinguished road

      0  

    Default


    thx man !

Thread Participants: 2