在打印屏幕上可以看到,下拉式是向上呈现的。谁能给我一个点,如何将其向下呈现?
代码 。
final Select2Choice<Country> originCountryDD = new Select2Choice<>("originCountry", new PropertyModel<Country>(this, "originCountry"), new CountryProvider());
private class CountryProvider extends ChoiceProvider<Country> {
@Override
public void query(String codeWithNameFragment, int i, Response<Country> response) {
if(codeWithNameFragment == null || "".equals(codeWithNameFragment)) {
response.addAll(countryDao.findAllWithStations());
} else {
response.addAll(countryDao.findByFragment(codeWithNameFragment));
}
}
@Override
public void toJson(Country country, JSONWriter jsonWriter) throws JSONException {
jsonWriter.key("id").value(country.getId()).key("text").value(country.getNameWithCode());
}
@Override
public Collection<Country> toChoices(Collection<String> collection) {
Collection<Country> countries = new ArrayList<>();
List<Country> countryList = countryDao.findAll();
for(String id : collection){
for(Country country : countryList) {
if(country.getId().equals(Long.valueOf(id))) {
countries.add(country);
}
}
}
return countries;
}
}
这是我的代码。我不知道,如何让select2呈现下拉式。任何帮助问候。
有"力量以上"参数。
你应该可以改成下面的强制...
源。https:/github.comselect2select2issues3121。
你可以试试下拉的位置。选择2 的时候,不能正常工作。Bootstrap 模式化...