我尝试将 OptionGroup 添加到我的表中,但到目前为止,无论我做什么,该表都是空的。
到目前为止,这是我尝试过的:
table = new Table();
table.setSizeFull();
table.addContainerProperty("Name", String.class, null);
table.addContainerProperty("Option one", OptionGroup.class, null);
table.addContainerProperty("Option two", OptionGroup.class, null);
opt1 = new OptionGroup("");
opt1.addItem();
opt1.addItem();
opt1.setMultiSelect(false);
table.addItem(new Object[] {"Name one", opt1.getItem(1),opt1.getItem(2)}, new Integer(1));
我是不是遗漏了什么,或者解决这个问题是否不像我的示例所示那么容易?
最佳答案
快速浏览一下,您似乎没有添加任何选项组选项。
您是否尝试过只添加 Option 类本身
table = new Table();
table.addContainerProperty("Name", String.class, null);
table.addContainerProperty("Option one", OptionGroup.class, null);
opt1 = new OptionGroup("Time");
opt1.addItem("AM");
opt1.addItem("PM");
table.addItem(new Object[] {"Name one", opt1}, new Integer(1));
我还会删除 setSizeFull()
如果出现问题,null 将成为默认值。
完成后,您可以使用 CSS 水平排列选项。
关于java - 表中的水平选项组 (Vaadin),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8309159/