1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    11
    Vote Rating
    0
    Ltty is on a distinguished road

      0  

    Question Unanswered: Portal Auto Resize

    Unanswered: Portal Auto Resize


    Hi,
    I've got a problem with the autoresizing of portals in my GWT application. Basically, I want to implement the portal like here. So if I change the window size, I want that my portlets also resize automatically to fit the window again. I guess in the provided example you are using a ViewPort. However, I have to add a menu additionally, so I use a LayoutContainer to put my portal in:

    Code:
    portal = new Portal(PORTLET_SIZE);
            
    portal.setStyleAttribute("backgroundColor", "white");
    portal.setColumnWidth(0, .5);
    portal.setColumnWidth(1, .5);
                    
    ContentPanel menuLayout = new ContentPanel();
    menuLayout.setHeight(500);
            
    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
    westData.setCollapsible(true);
    westData.setMargins(new Margins(5)); 
    westData.setHideCollapseTool(false); 
            
    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(5, 200, 5, 200));
            
    mainLayout.add(menuLayout, westData); 
    mainLayout.add(portal, centerData);
    So how can I implement the auto-resize behaviour for my portal? Is there also a way of setting the height of the layout container to the client window height? I haven't found a solution therefore yet.

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Location
    Iasi, Romania
    Posts
    144
    Vote Rating
    0
    Answers
    5
    catalin.ciobanu is on a distinguished road

      0  

    Default


    I had problems implementing something alike but not with portals ... with regular window+contentPanel.
    I solved this by using FitLayout on the parent and let setSize(-1,-1) on child components. I don't know if this is the optimum solution for this, but it worked as a charm for me.
    I hope it works on portal also.

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Answers
    109
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    The Viewport class should be added at the root level of your widgets to get children to resize as the browser changes size. Additionally, as Catalin mentioned, you should make sure you are using layouts correctly at each level.

    In your case, if the var mainLayout is a ViewPort and is added directly to the RootPanel instance, you should get the behavior you are after. Try posting a complete entrypoint that doesnt resize, and we can be more specific about what you need to change.

Thread Participants: 2

Tags for this Thread