如何在TextItem中设置DynamicForm的宽度?
方法TextItem#setWidth()不像预期的那样工作。
我也尝试过DynamicForm#setColWidths(),但仍然无法设置宽度。
这是我的密码
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;
public class AgeModelWindow extends Window {
public AgeModelWindow() {
TextItem textItem = new TextItem();
textItem.setWidth(50);
textItem.setLength(3);
textItem.setTitle("Age");
DynamicForm form = new DynamicForm();
form.setNumCols(2);
//form.setColWidths("*", "50");
form.setWidth100();
form.setItems(textItem);
this.setMargin(10);
this.setTitle("Enter your age");
this.addItem(form);
this.setWidth(200);
this.setHeight(100);
this.setLeft(100);
this.setTop(100);
this.draw();
}
}发布于 2014-03-04 19:53:49
我在textItem上使用css样式解决了这个问题。我不知道为什么它不能通过SmartGWT中的代码工作。
代码:
textItem.setCellStyle("textItemAge"); css:
.textItemAge input,.textItemAgeFocused input,.textItemAgeDisabled input,.textItemAgeDisabledHint input,.textItemAgeError input,.textItemAgeHint input
{
width: 50px !important;
}https://stackoverflow.com/questions/21986335
复制相似问题