SmartGWT - 如何将订单项目转换为动态表单?

时间:2016-07-04 21:54:11

标签: java smartgwt

我尝试使用列创建DynamicForm,但我无法将项目排序为列。当我将项目放在dynamicForm中以存在一个保持为空的列时。

Empty column - example

这是我使用的代码摘录:

DynamicForm form = new DynamicForm();
form.setTitleSuffix("");
form.setIsGroup(true);
form.setGroupTitle("DETALLES DEL PLAN");
form.setWidth(720);
form.setColWidths("150","200","150","200");
form.setNumCols(4);

StaticTextItem planT  = new StaticTextItem("Nombre de Plan: ");
StaticTextItem plan  = new StaticTextItem("PLAN B");

StaticTextItem tipoCartaT = new StaticTextItem("Tipo de Carte:");
tipoCartaT.setStartRow(true);
SelectItem tcSelect = new SelectItem();
tcSelect.setShowTitle(false);
StaticTextItem periodoT = new StaticTextItem("Periodo: ");
SelectItem peSelect = new SelectItem();
peSelect.setShowTitle(false);
peSelect.setEndRow(true);

StaticTextItem descT = new StaticTextItem("Descripcion del Plan");
descT.setStartRow(true);
TextAreaItem deText = new TextAreaItem();
deText.setShowTitle(false);
deText.setStartRow(true);
deText.setColSpan(3);
deText.setWidth(520);

form.setItems(planT,plan,tipoCartaT,tcSelect,periodoT,peSelect,descT,deText);

addMember(form);

我试着看起来像这样:

correct order form

1 个答案:

答案 0 :(得分:1)

默认情况下,当标题与左侧对齐时,StaticTextItems为2个Colums宽度。因此,您正在查看的空白区域是planT textItem的值。

您不需要为标题使用空的StaticTextItem,您可以这样做。

DynamicForm form = new DynamicForm();
form.setTitleSuffix("");
form.setIsGroup(true);
form.setGroupTitle("DETALLES DEL PLAN");
form.setWidth(720);
form.setColWidths("150","200","150","200");
form.setNumCols(4);

StaticTextItem planT  = new StaticTextItem("Nombre de Plan");
planT.setTitleOrientation(TitleOrientation.LEFT);
planT.setStartRow(true);
planT.setEndRow(true);
planT.setValue("Plan B");

SelectItem tcSelect = new SelectItem("Tipo de Carte");
tcSelect.setTitleOrientation(TitleOrientation.LEFT);
tcSelect.setStartRow(true);

SelectItem peSelect = new SelectItem("Periodo");
peSelect.setTitleOrientation(TitleOrientation.LEFT);
peSelect.setEndRow(true);

TextAreaItem deText = new TextAreaItem("Descripcion del Plan");
deText.setTitleOrientation(TitleOrientation.LEFT);
deText.setStartRow(true);
deText.setEndRow(true);
deText.setColSpan(3);

form.setItems(planT,tcSelect,peSelect,deText);

addMember(form);

我希望它有所帮助