Πέμπτη, 4 Φεβρουαρίου 2010

Wicket Autocomplete - Show suggestions on focus

There are some cases that an autocomplete field is used for a limited number of option. For instance it can be used for selection of a Country. So we should show to the user all the available options when he focus on the field. The solution is to extends the DefaultCssAutocompleteTextField of wicket and override the "newAutoCompleteBehavior(IAutoCompleteRenderer, AutoCompleteSettings)" method as follows
@Override
protected AutoCompleteBehavior newAutoCompleteBehavior(IAutoCompleteRenderer renderer, AutoCompleteSettings settings) {
settings.setShowListOnFocusGain(true);
settings.setShowListOnEmptyInput(true);
settings.setShowCompleteListOnFocusGain(true);
return super.newAutoCompleteBehavior(renderer, settings);
}
If you need even more details leave a comment and I will give you even more information..
Δημοσίευση σχολίου

Gadget

Αυτό το περιεχόμενο δεν είναι ακόμα διαθέσιμο μέσω κρυπτογραφημένων συνδέσεων.

LinkWithin

Blog Widget by LinkWithin

Mobile edition