【发布时间】:2016-07-11 03:47:19
【问题描述】:
Vaadin:我需要在更新表格内容后设置选定的行。 我有一个包含不同客户的组合框按钮。 另外我有两个表,第一个显示主要类别,第二个显示子类别。 最初,未选择客户,显示主要类别,未显示子类别。
当我点击一个类别时(比如说产品!),子类别表出现并显示子类别。 当我现在将客户从空更改为特定客户时,两个表都被过滤了,但是:产品选择丢失了。我需要将选择设置为之前选择的那个。
我从另一个类中获取表内容作为 sql-container 对象。
mainCatTable = new Table();
...
mainCatTable.setContainerDataSource(source.getMainCats());
//My Checkboxbutton
Combobox custBox = new ComboBox();
//Get the customers from the Database
custBox.setContainerDataSource(source.getCustomers());
custBox.setItemCaptionPropertyId("Customers");
custBox.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent valueEvent) {
//Here I need to store the old selection, before i update the mainCat table to a specific customer
mainCatTable.setContainerDataSource(source.getMainCats(currentCustomer));
//Here I need something to set the selected row to the previous value
subCatTable.setContainerDataSource(source.getSubCats());
}
});
getMainCats 方法返回的 sql-container 是这样创建的:
FreeformQuery subcatExtractionQuery = new FreeformQuery("select customerName from customers", connectionPool);
return new SQLContainer(subcatExtractionQuery);
问题是,尝试了不同的方法,但没有奏效。 这是我的尝试: https://vaadin.com/forum/#!/thread/1819417/1819416 但他们使用索引容器,但我没有。
谁能解释在没有索引容器的情况下如何做到这一点?
【问题讨论】:
-
那个“非索引容器”是什么样的控制器?你能说得更具体一点吗?
-
对不起,现在我添加了信息。这是你的意思吗?
标签: java select vaadin vaadin7