Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a more button to gwt Suggest Box

Tags:

java

gwt

I have a gwt suggest box that does an RPC call to get some data from the server and display it. In some cases there are up to 2000 results. Whilst this works fine in chrome when the javascript runs in firefox it freezes the window for 5 seconds and sometime brings up script not responding warnings.

What I wanted to do was something like show 20 results and have a more button that can just append the next 20 without having to call back to the server every time it is clicked. I am fairly new to this, I have tried extending suggestBox and overriding showSuggestions() but it is protected so I can't.

Any suggestions/ ideas would be great.

Cheers, Rob

like image 791
Rob Avatar asked Jan 21 '11 12:01

Rob


1 Answers

See this question for pointers on how to extend the GWT's SuggestBox - basically, you want to provide your own SuggestOracle (it's used for fetching the suggestions), maybe your textbox (see the links in the question I mentioned earlier) and most likely a custom SuggestBox.SuggestionDisplay. Those three are passed via the constructor to SuggestBox. See the existing default implementations (MultiWordSuggestOracle, SuggestBox.DefaultSuggestionDisplay) for some ideas :)

like image 67
Igor Klimer Avatar answered Oct 17 '22 05:10

Igor Klimer