I开发者_开发百科'm currently playing with the richfaces comboBox. You can check is here
I would like to know if there a way change how the suggestion are made in the combo box, instead of suggesting juste word that start with the same letter it would suggest word that have other word starting with that letter or combination of letter.
Here a example from the demo: From the current combo box if I type "Mo" the combo show Mongomery and " Monpelier" but I would like it to detect "Des Moines" has well since "Moines" start with "Mo".
You can use <rich:suggestionBox>
and define the custom autocomplete algorithm.
It's not possible with <rich:comboBox>
directly, but if you extend it and define it as a custom component, it is possible, by overriding the encodeSuggestionValues()
method of ComboBoxBaseRenderer
(actually of ComboBoxRenderer
)
If we want to use rich:comboBox
with a better suggestion method (not only "begins with" but "contains" or "contains any") we could enhance it on the client-side (as I did)...
In this article I share my (working) approach:
Enhanced rich:comboBox: Values (not only Text) and RegExp Suggestions.
So please test it and let me know what you think.
精彩评论