6

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

Rob
  • 703
  • 1
  • 7
  • 18
  • You should maybe take a look at http://code.google.com/p/advanced-suggest-select-box/ there's all you need there –  Jul 21 '11 at 13:43

3 Answers3

4

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 :)

Community
  • 1
  • 1
Igor Klimer
  • 15,321
  • 3
  • 47
  • 57
  • Thanks Igor, I implemented a custom SuggestBox.SuggestionDisplay in the end and passed that into the Suggestion Constructor. Works a charm. Means that I can limit the amount of looping that is done so firefox no longer dies trying! :) – Rob Jan 24 '11 at 16:49
  • 2
    No problem :) If you've got some interesting example code to share on `SuggestBox.SuggestionDisplay` that would be even better - you can include it in a new answer, the original question or I can even add it to my answer. – Igor Klimer Jan 25 '11 at 10:30
0

If you want to change source code of SuggestBox see this you should create com.google.gwt.user.client.ui packeges in your src root and copy there SuggestBox.java. When you use SuggestBox it calls your SuggestBox which is in your src.
Check this also it can be useful too

Community
  • 1
  • 1
Jama A.
  • 15,680
  • 10
  • 55
  • 88
0

First solution come to mind is that write your own widget which extends from SuggestBox and the second solution maybe change the default css parameters of suggestbox

.gwt-SuggestBox {
}
.gwt-SuggestBoxPopup {
}
.gwt-SuggestBoxPopup .item {
}
.gwt-SuggestBoxPopup .item-selected {
}
.gwt-SuggestBoxPopup .suggestPopupContent {
}