Add button to gwt Suggest Box

I have a gwt suggestion field that makes an RPC call to get some data from the server and display it. In some cases, up to 2000 results. Although this works fine in chrome when javascript runs in firefox, it freezes the window for 5 seconds and sometimes causes the script to not respond with warnings.

What I wanted to do was something like show 20 results and a larger button that could just add the next 20 without going to the server every time I clicked. I'm new to this, I tried extending suggestBox and overriding showSuggestions (), but it is protected, so I cannot.

Any suggestions / ideas would be great.

Cheers rob

+6
java gwt
source share
3 answers

See this question for pointers on how to extend the GWT SuggestBox - basically, you want to provide your own SuggestOracle (it is used to extract sentences), perhaps your text box (see links in the question I mentioned earlier) and most likely a custom SuggestBox.SuggestionDisplay . These three are passed through the constructor to the SuggestBox . See Existing Default Implementations ( MultiWordSuggestOracle , SuggestBox.DefaultSuggestionDisplay ) for some ideas :)

+4
source share

If you want to change the source code of SuggestBox, see this, you must create com.google.gwt.user.client.ui packages in your src root directory and copy SuggestBox.java there. When you use SuggestBox, it calls your SuggestBox, which is in your src.
Check this one may also be useful as well

0
source share

The first solution concludes that write your own widget that extends from the SuggestBox , and the second solution can change the CSS defaults from suggestbox

 .gwt-SuggestBox { } .gwt-SuggestBoxPopup { } .gwt-SuggestBoxPopup .item { } .gwt-SuggestBoxPopup .item-selected { } .gwt-SuggestBoxPopup .suggestPopupContent { } 
0
source share

All Articles