Michaël
Michaël

Reputation: 3671

Suggestbox returning suggestions that begin AND contain the user's input

I am using a SuggestBox and I am having some difficulties to obtain the good behavior of my application.

Consider the following list of suggestions :

1. lol 
2. good evening
3. goodbye
4. end 
5. saluti

If I use my SuggestBox with this list and I type "g" I will obtain :

1. good evening
2. goodbye

It I type "e" :

1. good evening
2. end

But what I want to obtain is the words containing the input and not only the ones beginning with the input. For example if I type "l", I want to obtain :

1. lol
2. saluti

and not only :

1. lol

How can I fix this?

Thank you for your help.

Upvotes: 2

Views: 603

Answers (1)

Mia Clarke
Mia Clarke

Reputation: 8204

The SuggestBox is using a SuggestOracle to decide what to return given some input. The default oracle for a SuggestBox is MultiWordSuggestOracle that has the behaviour you describe. If you want some other behaviour, you will have to write your own oracle by extending SuggestOracle. Check out this very good blog tutorial on how to implement autocompletion in GWT.

Upvotes: 5

Related Questions