PDA

View Full Version : DateField width not taking DatePickerButton into account



jayzeb
17 Sep 2008, 12:39 PM
GWT v1.5.2
GXT v1.1 (Released)

The DateField does not take it's DatePicker launching button into account when it calculates it's width. If you lay out the DataField and another widget side by side in a HorizontalPanel, the second widget will overlay the DateField's DatePicker launching button. Also, if invalid data is entered into the DatePicker and you tab to the second field, the error icon is placed on top of the DatePicker launching button (all of which is still hidden by the other widget in the HorizontalPanel. You can increase the spacing around of the HorizontalPanel so the DatePicker launching button is displayed, but this isn't ideal because the spacing is added all around, not just at the end of the DateField.

public class DFTest implements EntryPoint {
public void onModuleLoad() {
HorizontalPanel hp = new HorizontalPanel();
// hp.setSpacing(5); // uncomment to see part of the DatePicker button
hp.add(new DateField());
hp.add(new TextField());
RootPanel.get().add(hp);
}
}
Jay

jayzeb
19 Sep 2008, 8:07 AM
Any chance this can be acknowledged as an issue (with an eta on a fix) or if it isn't one how to get it to layout properly?

Thanks,
jay

darrellmeyer
19 Sep 2008, 11:15 AM
You need to give any TriggerField (DateField is one) an explict width. This is normally done by FormLayout, which you are not using. Try this:


public void onModuleLoad() {
HorizontalPanel hp = new HorizontalPanel();
hp.setSpacing(5); // uncomment to see part of the DatePicker button
DateField field = new DateField();
field.setWidth(150);
hp.add(field);
hp.add(new TextField());
RootPanel.get().add(hp);
}

jayzeb
19 Sep 2008, 3:41 PM
Sometimes the answer is so easy and obvious. *sigh*
So sorry to have wasted your time but still, many Thanks for the answer!!

jay