【发布时间】:2011-02-21 19:46:38
【问题描述】:
我正在使用 vaadin 应用程序,一个页面有两个组合框 1. 国家 2. 国家
基于我想填充州下拉值的国家/地区。 使用 valuechangeevent 我检索了该国家/地区的所有州我如何加载到州下拉菜单。
请帮帮我:)
【问题讨论】:
标签: drop-down-menu vaadin
我正在使用 vaadin 应用程序,一个页面有两个组合框 1. 国家 2. 国家
基于我想填充州下拉值的国家/地区。 使用 valuechangeevent 我检索了该国家/地区的所有州我如何加载到州下拉菜单。
请帮帮我:)
【问题讨论】:
标签: drop-down-menu vaadin
下面的示例代码可以帮助你实现你想要的
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);
}
});
【讨论】: