How can I change the offer made by combobox richfaces?

I am currently playing with richfaces comboBox. You can check here

I would like to know if there is a way to change the way the sentence is done in the combo box, instead of suggesting the word juste starting with the same letter, it would suggest a word that has a different word starting with that letter or combination letters,

Here is an example from the demo: In the current combo box, if I type "Mo" the Mongomery and "Monpelier" combo, but I would like it to find that "Des Moines" works well since "Moines" starts with "Mo".

+2


a source to share


2 answers


You can use <rich:suggestionBox>

and define a custom autocomplete algorithm.



This is not possible in use <rich:comboBox>

, but if you extend it and define it as a custom component, it is possible by overriding the method encodeSuggestionValues()

ComboBoxBaseRenderer

(in fact ComboBoxRenderer

)

+1


a source


If we want to use rich:comboBox

with a better suggestion method (not only "starts with" but "contains" or "contains any"), we could improve it on the client side (like me) ...

In this article, I share my (working) approach:
Enhanced rich: comboBox: values ​​(not just text) and RegExp clauses .



So please test it and let me know what you think.

0


a source







All Articles