Vaadin - 默认情况下 ComboBox 是否延迟加载?
Vaadin - Does ComboBox Lazy Load by Default?
Vaadin 7.6.2
BeanItemContainer
BeanItemContainer<CountryBean> countryBeanContainer
= new BeanItemContainer<>(CountryBean.class);
countryBeanContainer.addAll(CountryData.list);
country.setContainerDataSource(countryBeanContainer);
country.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
country.setItemCaptionPropertyId("name");
country.setTextInputAllowed(true);
...
...
CountryBean
public class CountryBean {
private String value;
private String name;
public CountryBean(String value, String name) {
this.value = value;
this.name = name;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
国家数据
public abstract class CountryData {
public static final List<CountryBean> list =
Collections.unmodifiableList(Arrays.asList(
new CountryBean("AF", "Afghanistan"),
new CountryBean("AX", "Åland Islands"),
new CountryBean("AL", "Albania"),
new CountryBean("DZ", "Algeria"),
new CountryBean("AS", "American Samoa"),
new CountryBean("AD", "Andorra"),
new CountryBean("AO", "Angola"),
new CountryBean("AI", "Anguilla"),
...
...
因此,我在 ComboBox 中进行了此设置 运行,并且效果很好。但我的问题是:这个包含 200 多个国家/地区的列表是编译到客户端代码中,还是在用户键入或浏览选项列表页面时从服务器延迟加载?我想了解这是如何工作的,因为我可能需要在我的 UI.
中有(比如说)5 个国家/地区字段
ComboBox
开箱即用地处理客户端和服务器之间的延迟加载。只有下拉列表中可见的行才会从服务器获取到客户端。因此,当您在下拉列表的不同页面之间进行过滤或导航时,它只会从服务器获取那些行。
Vaadin 7.6.2
BeanItemContainer
BeanItemContainer<CountryBean> countryBeanContainer
= new BeanItemContainer<>(CountryBean.class);
countryBeanContainer.addAll(CountryData.list);
country.setContainerDataSource(countryBeanContainer);
country.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY);
country.setItemCaptionPropertyId("name");
country.setTextInputAllowed(true);
...
...
CountryBean
public class CountryBean {
private String value;
private String name;
public CountryBean(String value, String name) {
this.value = value;
this.name = name;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
国家数据
public abstract class CountryData {
public static final List<CountryBean> list =
Collections.unmodifiableList(Arrays.asList(
new CountryBean("AF", "Afghanistan"),
new CountryBean("AX", "Åland Islands"),
new CountryBean("AL", "Albania"),
new CountryBean("DZ", "Algeria"),
new CountryBean("AS", "American Samoa"),
new CountryBean("AD", "Andorra"),
new CountryBean("AO", "Angola"),
new CountryBean("AI", "Anguilla"),
...
...
因此,我在 ComboBox 中进行了此设置 运行,并且效果很好。但我的问题是:这个包含 200 多个国家/地区的列表是编译到客户端代码中,还是在用户键入或浏览选项列表页面时从服务器延迟加载?我想了解这是如何工作的,因为我可能需要在我的 UI.
中有(比如说)5 个国家/地区字段ComboBox
开箱即用地处理客户端和服务器之间的延迟加载。只有下拉列表中可见的行才会从服务器获取到客户端。因此,当您在下拉列表的不同页面之间进行过滤或导航时,它只会从服务器获取那些行。