问题
I'm trying to convert a drop down box widget into a SuggestionBox because the current drop down menu has 100+ choices. It seems like you can only add String suggestions to a SuggestOracle though. I need to be able to add a custom object that contains both a description and an ID that matches the record to the database though. Would I have to extend the SuggestOracle class?
回答1:
Yes as i know you can not use pair of values i.e Id and Value. You have to add your strings in suggestion box perhaps you can use different solution other then suggestion box i.e. Create a List of values popup. And add as many fields as you like. display your data in flex table with pagination. update your form with the selected row by using selecition handler. for reference how to use FlexTable and handle events please see able Single Row Click Event
SuggestOracle
is the parent class of MultiWordSuggestOracle
which you are already yousing.
public class MultiWordSuggestOracle extends SuggestOracle
see MultiWordSuggestOracle
来源:https://stackoverflow.com/questions/10249430/creating-a-gwt-suggestoracle-with-custom-object-suggestions