Hi,
Igor Vaynberg-2 wrote
>
> you should declare your Select2Choice as Select2Choice<Short> since
> that is its model type. once you do this the compiler will tell you
> that your TextChoiceProvider should be TextChoiceProvider<Short>
> instead of <HrpBbhepar5>
>
> -igor
>
In this case I can't search for description hence only the values are
displayed. Only I want to search for some text and get back it's id into a
Short field.
private class Hepar5Provider extends TextChoiceProvider<Short> {
@Override
protected String getDisplayText(Short choice) {
return choice.toString();
}
@Override
protected Object getId(Short choice) {
return choice;
}
@Override
public void query(String term, int page, Response<Short> response) {
response.addAll(queryMatches(term, page, 10));
response.setHasMore(response.size() == 10);
}
@Override
public Collection<Short> toChoices(Collection<String> ids) {
ArrayList<Short> hepar5idlist = new ArrayList<Short>();
Iterator it = hepar5list.iterator();
while (it.hasNext()) {
HrpBbhepar5 h = (HrpBbhepar5) it.next();
hepar5idlist.add(h.getHrpBbhepar5PK().getDertek());
}
return hepar5idlist;
}
}
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/select2-localization-questions-tp4651732p4651765.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]