我有一个网格,我需要在它之前和之后添加 2 个链接。它们是相同的,它们只需要在网格上方和下方都可见。我将它们放在 ToolStrip 中,并将 ToolStrip 添加为 VLayout 的成员两次。问题是 ToolStrip 添加了两次,但是这对链接仅在下面看到(或仅添加到第二个 ToolStrip)。我做错了什么?这是代码:
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);
非常感谢您提前。