Add a more button to gwt Suggest Box
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 w开发者_如何学运维ould be great.
Cheers, Rob
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 :)
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
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 {
}
精彩评论