我正在嘗試設置更新vaadin中的bean項目的組合框值。但是當我打開它時,組合框選定的值爲空。我如何綁定價值?如何使用beanitemcontainer設置vaadin組合框值?
BeanItemContainer<Company> itemContainer = new BeanItemContainer<Company>(Company.class);
itemContainer.addAll(companyService.getAllCompanies());
cbxCompanyName = new ComboBox("Company Name", itemContainer);
cbxCompanyName.setWidth("50%");
cbxCompanyName.setNullSelectionAllowed(false);
cbxCompanyName.setItemCaptionMode(ItemCaptionMode.PROPERTY);
cbxCompanyName.setImmediate(true);
cbxCompanyName.setItemCaptionPropertyId("companyName");
cbxCompanyName.setNewItemsAllowed(false);
details.addComponent(cbxCompanyName);
cbxCompanyName.setValue(admin.getCompany());
你有沒有在Company類上實現equals和hashcode? –