View Full Version : FitLayout sizes children wrong when container specifies width as a percentage

4 Sep 2009, 7:06 AM
I'm using a LayoutContainer that has a width specified as a percentage and is using a fit layout to size a child LayoutContainer. The problem is that the fit layout is treating the percentage value as a pixel value when sizing the child.

Version: 2.0.1
Mode: both
Browser: Firefox 3.0
OS: Kubuntu

Sample code:

import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class Test implements EntryPoint {

public void onModuleLoad() {
LayoutContainer c = new LayoutContainer();
c.setLayout(new FitLayout());
c.setSize("90%", "40px");
c.setStyleAttribute("border", "1px solid red");

LayoutContainer fitted = new LayoutContainer();
fitted.setStyleAttribute("border", "1px solid green");


}In the screen shots you can see that the child is given a width of 90px.

4 Sep 2009, 7:09 AM
Layouts are not working with percentage values. That is the reason why we have layouts. I am moving this to the help forum as this was discussed several times.