1. #1
    Sencha User
    Join Date
    Nov 2010
    Location
    Brest (France)
    Posts
    7
    Vote Rating
    0
    neolitec is on a distinguished road

      0  

    Question FitLayout and 100% height

    FitLayout and 100% height


    Hi,

    I have a problem when trying to apply a 100% height to a widget (a LayoutContainer in this case).
    This LayoutContainer has a FitLayout layout and it's contained in a GWT widget with a height of 100% (depending on the window height).
    Since the parent widget has no layout, I've fixed its height at 100%.

    Now I have a FitLayouted LayoutContainer ^^ with a height of 100%.
    Step 1 : success !

    Now I want to add a simple ContentPanel in this LayoutContainer.
    According to the documentation, the ContentPanel should take the size of the layout's container, i.e. 100%.
    But that takes 100 pixels invariably.

    Step 2 : fail !

    2 questions :
    - Is that problem due to the fact that I specified height in percent and not in pixels ?
    - Is there a workaround ? (bonus : is it not recommended to mix GWT and GXT items ?)

    Another one : why 100 pixels ??

    Here is an piece of the source :
    Code:
    public class MyWidget extends LayoutContainer {
    	
    	protected void onRender(final Element target, final int index) {
    		super.onRender(target, index);
    
    		FitLayout layout = new FitLayout();
    		setHeight("100%");
    		setLayout(layout);
    
    		ContentPanel cp = new ContentPanel();
    		add(cp);
    	}
    
    }
    Thanks !

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Instead of setting a size by hand, especially when using percentage sizes, you should use the layoutsystem to size your widgets. Were do you add your MyWidget class? Why do you wrap a ContentPanel inside a LayoutContainer with a FitLayout?

  3. #3
    Sencha User
    Join Date
    Nov 2010
    Location
    Brest (France)
    Posts
    7
    Vote Rating
    0
    neolitec is on a distinguished road

      0  

    Default


    No, the parent widget is not a LayoutContainer neither a ContentPanel, it's a GWT Composite... so I can't use the layout system.
    And that's why a asked this question : is it not recommended to mix GWT and GXT items ?

    I agree with you, including a ContentPanel inside a LayoutContainer with a FitLayout is simply . In fact, the goal is to include a west and a center region with a BorderLayout... the ContentPanel simplifies the problem.
    I tried to replace FitLayout directly with a BorderLayout but it doesn't work : even if the BorderLayout is "100% capable", the included ContentPanels (for west and center region) take no height when I specify nothing, and 100px when I specify 100% !

    I thought GXT was able to resize widgets inside pure GWT widgets but obivious it can't (.

Thread Participants: 1

Tags for this Thread