0
设置值后,我在vaadin组合框中遇到问题。这里是我的代码Vaadin ComboBox setValue不工作
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());
究竟什么不行?是否有错误或意外行为? –
猜测:您的分销商不提供适当的平等手段,因此组合框使用对象标识,因此客户分销商是另一个对象,因此不会在未选中的容器中找到。 – cfrick