[英]Vaadin Combo Box
我正在使用vaadin應用程序,頁面上有兩個組合框1.國家2.國家
基於我要填充的國家/地區的下拉值。 我使用valuechangeevent檢索了該國家/地區的所有州,如何加載這些州的下拉列表。
請幫助我 :)
下面的示例代碼可以幫助您實現所需的功能
AbstractOrderedLayout outerLayout = new VerticalLayout();
final Map<String, List<String>> map = new HashMap<String, List<String>>();
List<String> stateList = new ArrayList<String>();
stateList.add("state1");
stateList.add("state2");
stateList.add("state3");
map.put("USA", stateList);
final ComboBox country = new ComboBox("country",map.keySet());
country.setImmediate(true);
outerLayout.addComponent(country);
country.addListener(new Property.ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
ComboBox stateComboBox = new ComboBox("state",map.get(country.getValue().toString()));
outerLayout.addComponent(stateComboBox);
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.