View Full Version : [FIXED] bug in DateField resizing in FormPanel
makados
11 Jun 2008, 1:01 AM
Hi
I have a next piece of code:
FormPanel formPanel = new FormPanel();
formPanel.setHeaderVisible(false);
formPanel.setLabelWidth(100);
formPanel.setFieldWidth(210);
formPanel.setIconStyle("icon-form");
formPanel.setFrame(true);
formPanel.setWidth(400);
formPanel.setButtonAlign(Style.HorizontalAlignment.CENTER);
formPanel.setScrollMode(Style.Scroll.AUTO);
DateField birthDateField = new DateField();
birthDateField.setFieldLabel(MCMessages.msg.contact_birthdate()); birthDateField.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd.MM.yyyy"));
birthDateField.setWidth(193);
formPanel.add(birthDateField);
DateField resizing doesn't work and I have that field bigger than others. Resizing of other fields in my FormPanel doesn't work too. If I write
formPanel.setFieldWidth(0);than resizing of all fields works except for DateField. And if I write
formPanel.setFieldWidth(-1);than resizing works well for all fields in the FormPanel
darrellmeyer
12 Jun 2008, 6:51 AM
FormLayout now honors the field's width if it has been specified. Fix is in SVN.
darrellmeyer
17 Jun 2008, 5:52 AM
In order to override the width of any fields, you should use a FormData and specify a width. Setting the width on the field itself will not work.
makados
17 Jun 2008, 9:35 AM
on beta5 next code
FormPanel formPanel = new FormPanel();
formPanel.setHeaderVisible(false);
formPanel.setLabelWidth(100);
formPanel.setFieldWidth(235);
formPanel.setFrame(true);
formPanel.setButtonAlign(Style.HorizontalAlignment.CENTER);
birthDateField.setFieldLabel("Birthday"); birthDateField.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd.MM.yyyy"));
FormData fd = new FormData();
fd.setWidth(218);
formPanel.add(birthDateField, fd);
gives an error:
[ERROR] Uncaught exception escaped
java.lang.ClassCastException: com.extjs.gxt.ui.client.widget.layout.FormData
at com.extjs.gxt.ui.client.widget.layout.AnchorLayout.onLayout(AnchorLayout.java:93)
at com.extjs.gxt.ui.client.widget.layout.FormLayout.onLayout(FormLayout.java:191)
at com.extjs.gxt.ui.client.widget.Layout.layout(Layout.java:68)
at com.extjs.gxt.ui.client.widget.Container.doLayout(Container.java:252)
at com.extjs.gxt.ui.client.widget.Container.layout(Container.java:343)
at com.extjs.gxt.ui.client.widget.LayoutContainer.layout(LayoutContainer.java:235)
at com.extjs.gxt.ui.client.widget.Container.doLayout(Container.java:259)
at com.extjs.gxt.ui.client.widget.Container.layout(Container.java:343)
at com.extjs.gxt.ui.client.widget.LayoutContainer.layout(LayoutContainer.java:235)
at com.extjs.gxt.ui.client.widget.Container.doLayout(Container.java:259)
maybe in SVN its already fixed, i don't know :)
darrellmeyer
17 Jun 2008, 1:00 PM
FormData needs to extend AnchorData which it does not in b5. This is correct in SVN.
michaelosity
18 Jun 2008, 8:56 AM
This still doesn't work for me using the latest from SVN as of Wednesday 18th. I have code as follows:
FormPanel form = new FormPanel();
form.setHeaderVisible(false);
form.setFrame(false);
form.setBodyBorder(false);
form.setLabelWidth(100);
TextField<String> field = new TextField<String>();
form.add(field, new FormData(150, 0));
field.setLabelStyle("color: darkgray;");
field.setLabelSeparator("");
field.setFieldLabel("Test Label:");
field.setWidth(150);
field.setValue("Test Value");
----
The field width of "150" is not honored.
darrellmeyer
18 Jun 2008, 9:01 AM
There is a slight change, you need to use a FormData instance to specify the field width (see the previous posts).
michaelosity
18 Jun 2008, 9:07 AM
I did use a FormData() instance.
darrellmeyer
18 Jun 2008, 9:36 AM
Sorry about that. I scanned your code and saw the line where you were setting the width directly first. There was a bug, the fix is in SVN.
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.