2017-03-16 7 views
0

値を設定した後、vaadinコンボボックスで問題が発生します。 distributorService.find(null).contains(this.entity.getCustomer().getDistributor())場合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()); 
+1

正確に何が動作しないのですか?エラーまたは予期しない動作がありますか? –

+0

推測:あなたのディストリビューターは、コンボボックスがオブジェクトアイデンティティを使用するので、顧客ディストリビュータが別のオブジェクトであり、選択されていないコンテナ内に見つからないように、適切な平等の手段を提供しません。 – cfrick

答えて

0

であるかを確認できます。

beans.getItemIds().contains(this.entity.getCustomer().getDistributor());がtrueを返すかどうかを確認することもできます。

上記のステートメントのいずれかがtrueを返す場合、選択は機能するはずです。 クライアントがコンテンツを更新しない可能性がありますか?試してくださいgetUI().access(() -> getUI().push());

関連する問題