PDA

View Full Version : FieldSet not showing



alawi
30 Aug 2008, 2:11 PM
Hello guys,

I am new to gxt, and I am trying to add items to a fieldset and then add the fieldset to the panel, but nothing is being shown on the panel. Does the fieldset work?

Alawi

gslender
30 Aug 2008, 4:30 PM
post some code - I hate guessing... :D

alawi
30 Aug 2008, 5:20 PM
Hello gslender,

It is very simple code, I am just testing the fieldset, I am not sure if this is the right way of using it.

public void onModuleLoad() {

FormPanel panel = new FormPanel();
panel.setFrame(true);
panel.setFieldWidth(210);
panel.setButtonAlign(HorizontalAlignment.CENTER);
panel.setWidth(400);
panel.setStyleAttribute("padding", "20");

FieldSet nameFS = new FieldSet();

TextField text = new TextField();
text.setFieldLabel("Testing");

nameFS.add(text);
panel.add(nameFS);

RootPanel.get().add(panel);

}

gslender
30 Aug 2008, 5:35 PM
you were close...


ContentPanel panel = new ContentPanel();
panel.setFrame(true);
panel.setWidth(450);
panel.setStyleAttribute("padding", "20");

FieldSet nameFS = new FieldSet();
nameFS.setLayout(new FormLayout());
nameFS.setHeading("Some heading");

TextField text = new TextField();
text.setFieldLabel("Testing");

nameFS.add(text);
panel.add(nameFS);

RootPanel.get().add(panel);

alawi
30 Aug 2008, 5:45 PM
yup, its working just fine, beauty.. thanks for the quick respond.

alawi
1 Sep 2008, 11:46 AM
Hi again gslender,

I am still wondering why is not possible to add fieldset to formpanels (they don't show for me), the formpanel panel provide some methods that comes handy such is isDiry(), isValid() etc, that needs to be re-implemented..

Any insights?

Regards,
Alawi

gslender
1 Sep 2008, 7:54 PM
you can only add items that extend field to anything that uses a formlayout - and formpanel uses a formlayout