PDA

View Full Version : GXT 2.2 Textfield setWidth("100%") is not working



miwe76
23 Jul 2010, 12:17 AM
In GXT 2.2 Textfield setWidth("100%") is not working.
When i try it like this: setWidth("100") the textfield width is set to 100px...

With GXT 2.0 setWidth("100%") was ok....

Do i have to do something different to use percentage width?

Thank u for help

sven
23 Jul 2010, 12:40 AM
percentages witdth were never working. You should use the layoutsystem

miwe76
23 Jul 2010, 12:43 AM
Why did it work width GxT 2.0 when i use testfield.setWidth("100%");?
How can i say to a layout that there certain textfield that will a have a width with 100%?

sven
23 Jul 2010, 12:44 AM
Also if it looked that it worked, it was not working.

You cano do that with the FormLayout for example. However, nobody can asnwer this for you, as younobody knows your app and nobody knows what you are doing. You need to psot your code so that somebody can help you

miwe76
26 Jul 2010, 1:43 AM
Here is my Code.

The instrumentDescriptionTf set the width not to 100%. only the div arround the input field set the width the 100%.
So the textfield is smaller than the Cell of the Column

TableLayout inputFieldsTableLayout = new TableLayout(7);
inputFieldsTableLayout.setCellSpacing(5);
inputFieldsTableLayout.setBorder(1);

final ContentPanel textFieldsFilterPanel = new ContentPanel(inputFieldsTableLayout);
textFieldsFilterPanel.setHeaderVisible(false);
textFieldsFilterPanel.setBodyBorder(false);
textFieldsFilterPanel.setWidth("100%");
textFieldsFilterPanel.setAutoWidth(true);

TableData datelabelColumnsData = new TableData();
TableData datefieldColumnsData = new TableData();
final DateField dateFromTf = new DateField();
dateFromTf.setFieldLabel("FROM");
Text dateFrom = new Text( dateFromTf );
textFieldsFilterPanel.add(dateFrom,datelabelColumnsData);
datefieldColumnsData.setColspan(3);
textFieldsFilterPanel.add(dateFromTf,datefieldColumnsData);

datelabelColumnsData = new TableData();
datefieldColumnsData = new TableData();
final DateField dateTillTf = new DateField();
dateTillTf.setFieldLabel(TILL);
Text dateTill = new Text( dateTillTf );
textFieldsFilterPanel.add(dateTill,datelabelColumnsData);
datefieldColumnsData.setColspan(2);
textFieldsFilterPanel.add(dateTillTf,datefieldColumnsData);

//2. Row.
TableData labelColumnsData = new TableData();
TableData textfieldColumnsData = new TableData();
TableData buttonColumnsData = new TableData();
textfieldColumnsData.setColspan(2);
Text instrument = new Text("INSTRUMENT");
textFieldsFilterPanel.add(instrument,labelColumnsData);
final TextField instrumentTf = new TextField();
instrumentTf.setFieldLabel("INSTRUMENT");
textFieldsFilterPanel.add(instrumentTf,textfieldColumnsData);

instrumentSearchButton = new Button("SEARCH");
instrumentSearchButton.setToolTip("SEARCH");

textFieldsFilterPanel.add(instrumentSearchButton,buttonColumnsData);
textfieldColumnsData = new TableData();
textfieldColumnsData.setColspan(3);
final TextField instrumentDescriptionTf = new TextField();

instrumentDescriptionTf.setFieldLabel("DESCRIPTION");
instrumentDescriptionTf.setReadOnly(true);
instrumentDescriptionTf.getWidth();
instrumentDescriptionTf.setWidth("100%");
instrumentDescriptionTf.addInputStyleName("input-readonly");

textFieldsFilterPanel.add(instrumentDescriptionTf,textfieldColumnsData);
basePanel.add(textFieldsFilterPanel, textFieldsColumnsData);

miwe76
26 Jul 2010, 1:44 AM
How can i set the width of the instrumentDescriptionTf to 100%?