PDA

View Full Version : Dialog rendering issue



aus_gwit
21 Sep 2011, 5:41 AM
Hello!

Im struggling with an rendering issue in a Dialog:
I have the following (simple) piece of code


import com.google.gwt.user.client.Element;

import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.RowData;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;

public class TerminAnkgdDialog extends Dialog {

private ModelData termin;
private LayoutContainerWidget mainContainer = null;
private LayoutContainerWidget topContainer = null;
private LayoutContainerWidget bottomContainer = null;

@Override
protected void onRender(Element parent, int pos) {

super.onRender(parent, pos);
this.setButtons("");
this.setShadow(true);
this.setModal(true);
this.setWidth(480);
this.setHeight(600);
this.setLayout(new FitLayout());

this.mainContainer = new LayoutContainer();
// VBoxLayout vBoxLayout = new VBoxLayout();
// vBoxLayout.setPadding(new Padding(5));
// vBoxLayout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCH);
this.mainContainer.setLayout(new RowLayout(Orientation.VERTICAL));

this.topContainer = new LayoutContainer();
this.topContainer.setBorders(true);
this.bottomContainer = new LayoutContainer();
this.bottomContainer.setBorders(true);

this.mainContainer.add(this.topContainer, new RowData(-1, 0.8, new Margins(5)));
this.mainContainer.add(this.bottomContainer, new RowData(-1, 0.2, new Margins(5)));

this.add(this.mainContainer);

}
}


It simply shows a Dialog with LayoutContainers with 80 % to 20 %.
The problem is: It is only rendered correctly after the Dialog is being resized:
Before resizing:
28211


After resizing:
28212

Does anyone know what am i doing wrong?
Thank you very much

sven
21 Sep 2011, 7:38 AM
Which version of GXT are you using? If you using GXT 2.2.3 or 2.2.4 you need to call layout(true) on the dialog after showing it. This is fixed in GXT 2.2.5

aus_gwit
22 Sep 2011, 5:29 AM
Thank You sven!

I didn't noticed the release of 2.2.5.