0
我有一個網格,我需要在它之前和之後添加2個鏈接。他們是一樣的,他們只需要在網格上方和下方都可見。我把它們放在ToolStrip中,並將兩個ToolStrip添加爲VLayout的成員。問題是ToolStrip被添加了兩次,但是這兩個鏈接僅在下面看到(或者僅添加到第二個ToolStrip)。我做錯了什麼?這裏是代碼:SmartGWT幾次添加同一個成員到一個佈局
import com.google.gwt.core.client.GWT;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.LinkItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.toolbar.ToolStripButton;
final VLayout container = new VLayout(10);
container.setAlign(VerticalAlignment.CENTER);
final DynamicForm someForm1 = new DynamicForm();
// some form with text
final DynamicForm someForm2 = new DynamicForm();
// some other form with text
final VLayout grid = new VLayout(0);
grid.setWidth100();
final DynamicForm linksForm = new DynamicForm();
linksForm.setWidth100();
linksForm.setHeight(20);
linksForm.setNumCols(2);
final LinkItem linkOne = new LinkItem();
linkOne.setShowTitle(false);
linkOne.setValue("Click1");
linkOne.setTextAlign(Alignment.RIGHT);
final LinkItem linkTwo = new LinkItem();
linkTwo.setShowTitle(false);
linkTwo.setValue("Click2");
linkTwo.setTextAlign(Alignment.RIGHT);
linksForm.setFields(linkOne, linkTwo);
final ToolStrip linksToolStrip = new ToolStrip();
linksToolStrip.setWidth100();
linksToolStrip.setAlign(VerticalAlignment.CENTER);
linksToolStrip.addMember(linksForm);
final ListGrid results = new ListGrid();
// height, width, dataSource for ListGrid results, etc.
grid.addMember(linksToolStrip, 0);
grid.addMember(results, 1);
grid.addMember(linksToolStrip, 2);
container.setMembers(someForm1, grid, someForm2);
非常感謝您提前。