Is there a way to “combine” the SelectOneManu and autoComplete feature?
When the form is loaded I’d like that input field to display the current value of the bean property, plus ability to select a new value with autoComplete.
Is there a way to combine the SelectOneManu and autoComplete feature? When the form
Share
Primefaces already provides this already in the autocomplete component. Just look on the demo site. By adding the
dropdown="true"on the autocomplete menu, you enable support for a dropdown. Concretely, follow the following steps to get your resultsSet
dropdown="true"on your autocomplete menu. Then set thecompleteMethodto correspond to a method on your backing bean that returns a list of the items you want to show up in the dropdown menu.To preset the value on the autocomplete component, simply initialise the value in the backing bean to whatever you want. Take the following as an example. If you have
In your backing bean, you initialise the
myVariabletype during it’s declarationIf you’re going to be populating the dropdown list with a list of complex/POJO types (and as a result, bind the
valueattribute to a complex type in the backing bean), you’ll need to use the converter based autocomplete component implementation