PDA

View Full Version : formpanel can not layout after removeall



bhomass
5 Jan 2010, 11:35 PM
I found this thread
http://www.extjs.com/forum/showthread.php?t=79659&highlight=formpanel+removeall+label

which may be related to what I am finding. maybe someone can tell me if this problem is also fixed in the svn.

my formpanel works at first. after removeAll() and add back some form fields, it bombs inside FormLayout consistently at line 338.

is this a known bug in gxt 2.0?

jules
19 Jan 2010, 3:10 AM
I got the same problem: removeAll() and add() of fields afterwards causes NPE at line 338.
I'm using GXT 2.1.
Tanks for answers!

gxting
11 May 2010, 7:06 PM
When I add Formlayout to the formPanel, I am getting similar error at line 338 of FormLayout.renderField(). I am using GXT 2.1.1. Without FormLayout, No error. Any idea why? After I build following content panel, I remove content panel from parent and attach this one...




FormPanel searchFormPanel = new FormPanel();
ContentPanel userAdminPanel = new ContentPanel();
ContentPanel userListPanel = new ContentPanel();
Button searchButton = new Button();
Button clearButton = new Button();

searchFormPanel.setId("searchForm");
searchFormPanel.setHeading("Search Users");
searchFormPanel.setHeaderVisible(true);
searchFormPanel.setWidth(350);
searchFormPanel.setLayout(new RowLayout(Orientation.VERTICAL));

searchFormLayout.setLabelWidth(125);
searchFormLayout.setLabelAlign(LabelAlign.RIGHT);

searchFormPanel.setLayout(searchFormLayout);

TextField<String> searchC = new TextField<String>();
searchC.setId("searchC");
searchC.setFieldLabel("Search Criteria");
searchC.setWidth(75);

FormData f = new FormData(300, -1);
searchFormPanel.add(searchC, f);

searchFormPanel.setButtonAlign(HorizontalAlignment.CENTER);

searchButton.setId("search");
searchFormPanel.addButton(searchButton);

clearButton.setId("clear");
searchFormPanel.addButton(clearButton);

userAdminPanel.add(searchFormPanel);
userAdminPanel.add(userListPanel);

userAdminPanel.setBodyBorder(false);
userAdminPanel.setFrame(true);
userAdminPanel.setLayout(new RowLayout(Orientation.VERTICAL));
userAdminPanel.setHeaderVisible(false);

add(userAdminPanel);



Error Message:



[ERROR] Uncaught exception escaped
java.lang.NullPointerException: null
at com.extjs.gxt.ui.client.widget.layout.FormLayout.renderField(FormLayout.java:338)
at com.extjs.gxt.ui.client.widget.layout.FormLayout.renderComponent(FormLayout.java:307)
at com.extjs.gxt.ui.client.widget.Layout.renderAll(Layout.java:353)
at com.extjs.gxt.ui.client.widget.Layout.onLayout(Layout.java:318)
at com.extjs.gxt.ui.client.widget.layout.AnchorLayout.onLayout(AnchorLayout.java:99)
at com.extjs.gxt.ui.client.widget.layout.FormLayout.onLayout(FormLayout.java:267)
at com.extjs.gxt.ui.client.widget.Layout.layout(Layout.java:114)
at com.extjs.gxt.ui.client.widget.Layout$3.handleEvent(Layout.java:170)
at com.extjs.gxt.ui.client.util.DelayedTask$1.run(DelayedTask.java:30)
at com.extjs.gxt.ui.client.util.DelayedTask.delay(DelayedTask.java:52)
at com.extjs.gxt.ui.client.widget.Layout.onResize(Layout.java:344)
at com.extjs.gxt.ui.client.widget.Layout$2.handleEvent(Layout.java:135)

jocy
12 May 2010, 12:01 AM
Formpanel panel default has Formlayout as layout so when you set again his layout as Formlayout, I think that i normal that there is an error.
Formlayout is made to attribute caracteristic of formpanel to a simple panel !!!