Auto Complete component is based on Yahoo UI autocomplete widget, the component extends Standard HtmlInputText and adds ajaxified text suggestion feature.
| component-family | net.sf.yui4jsf |
| renderer-type | net.sf.yui4jsf.component.AutoCompleteRenderer |
| component-class | net.sf.yui4jsf.component.autocomplete.AutoComplete |
| renderer-class | net.sf.yui4jsf.component.autocomplete.AutoCompleteRenderer |
| tag-class | net.sf.yui4jsf.component.autocomplete.AutoCompleteTag |
<yui:autocomplete value= "#{backingBean.someValue}"
completeMethod= "#{backingBean.generateQueries}"
enableLogging= "true|false"
highlightClass = "highlightStyleClass"
maxResultsDisplayed = "10"
minQueryLength = "5"
forceSelection = "true|false"
queryDelay = "3"
autoHighlight = "true|false"
useIFrame = "true|false"
typeAhead = "true|false"
allowBrowserAutocomplete = "true|false"
alwaysShowContainer = "true|false" >
</yui:autocomplete>
Method in java bean
public List generateQueries(String query){
List list = new ArrayList();
for( int i = 0 ; i < 10; i++)
list.add(query + i);
return list;
}
Different version when the maxResultsDisplayed is specified
public List generateMaxSizedQueries(String query, Integer size){
List list = new ArrayList();
for( int i = 0 ; i < size.intValue(); i++)
list.add(query + i);
return list;
}
<yui:autocomplete>
Standard Attributes - id, rendered, binding, converter, validator, immediate, required.
Standard HtmlInputText Attributes - alt, accesskey, lang, dir, size, maxlength and etc...(See the taglib docs for the complete list)
completeMethod - completeMethod that takes String (query String) and Integer (size), and returns list of suggested items.
enableLogging - Boolean value to display the autoComplete with a yui logger, default is false
highlightClass - Style class that defines how the highlighter will be shown, default is background : blue.
maxResultsDisplayed - Optional value to limit the results size to be displayed
minQueryLength - Minimum characters required to make a query, default is 1
forceSelection - Forces user to select a result from the result set, if not the query is deleted from the input. Default is false
queryDelay - Query delay in terms of seconds.
autoHighlight - Highlighting the first result automatically
useIFrame - using the IFrame for IE5.x and IE6 users
typeAhead - Selecting the first result automatically
allowBrowserAutocomplete - Allowing browsers auto complete for the input.
alwaysShowContainer - Always show the results