Reputation: 479
I've defined a suggestbox in UIBinder, and I need to dynamically set its SuggestOracle. All the examples I've seen show that you can only define the suggestoracle at instantiation, but I need to define this AFTER the fact. Is there a way to do this?
Thanks!
Upvotes: 13
Views: 3419
Reputation: 1466
As italo said, get the instance of SuggestOracle with getSuggestOracle(), then you can do a orcl.clear() to clean all the contents and finally addAll().
You can also check out this example that shows a SuggestBox (models) that depends on the selected value on another main SuggestBox (car brands).
http://siempredesdeelcurro.blogspot.com.es/2013/05/simplest-example-of-gwt-with-eclipse.html
Upvotes: 0
Reputation: 15699
Use the method getSuggestOracle
at SuggestBox
to get the oracle. By default, it's from type MultiWordSuggestOracle
. Then, just add the words you want:
MultiWordSuggestOracle orcl = (MultiWordSuggestOracle) suggestBox.getSuggestOracle();
orcl.addAll(words);
Upvotes: 10