【发布时间】:2017-03-16 05:26:10
【问题描述】:
设置值后,我在 vaadin 组合框中遇到问题。这是我的代码
public class ComponentService implements FieldGroupFieldFactory {
/**
* Create Distributor ComboBox
*/
public ComboBox createComboBoxDistributor(String caption, boolean required) {
ComboBox c = new ComboBox(caption);
BeanItemContainer<Distributor> beans = new BeanItemContainer<Distributor>(Distributor.class);
beans.addAll(distributorService.find(null));
c.setContainerDataSource(beans);
c.setFilteringMode(FilteringMode.CONTAINS);
c.setRequired(required);
return c;
}
}
ComboBox comboDistributor = componentService.createComboBoxDistributor("Disributor", false);
comboDistributor.setValue(this.entity.getCustomer().getDistributor());
【问题讨论】:
-
究竟是什么不起作用?是否存在错误或意外行为?
-
猜测:您的分销商没有提供适当的平等方式,因此组合框使用对象标识,因此客户分销商是另一个对象,不会在容器中找到因此未被选中。