private List<CustomSuggestion> getMatchingCities(String query, int limit) {
List<CustomSuggestion> list = new ArrayList<CustomSuggestion>();
RequestBuilder request = new RequestBuilder(RequestBuilder.GET,url+"?query="+query+"&limit=" + limit);
request.setCallback(new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
//parse the result (maybe JSON) and populate your ArrayList
}
@Override
public void onError(Request request, Throwable exception) {
// TODO Auto-generated method stub
}
});
try
{
request.send();
}
catch (Exception e) {
}
}
On Sunday, August 26, 2012 11:20:31 PM UTC+2, Deepak Singh wrote:
Hi,I tried this waypublic class CustomSuggestion implements Suggestion{public CityNameDTO dto = null;public CustomSuggestion(CityNameDTO dto) {this.dto = dto;}@Overridepublic String getDisplayString() {return dto.getCityName();}@Overridepublic String getReplacementString() {return dto.getCityId();}}public class CustomSuggestOracle extends SuggestOracle{List<CustomSuggestion> citySugggestions = null;@Overridepublic void requestSuggestions(Request request, Callback callback) {Response response = new Response(getMatchingCities(request.getQuery(), request.getLimit())); }private List<CustomSuggestion> getMatchingCities(String query, int limit) {List<CustomSuggestion> list = new ArrayList<CustomSuggestion>();}}Now i am not able to understand how to go ahead with this customSuggestOracle.Could you pls guide me here?ThanksDeepakOn Sun, Aug 26, 2012 at 11:18 PM, Thomas Broyer <t.br...@gmail.com> wrote:
On Sunday, August 26, 2012 6:36:11 PM UTC+2, Deepak Singh wrote:But after selecting a value, how do i get the id of the selected value?
SuggestBox works best if you use the ID as the "replacementString" and the label as the "displayString" of the Suggestions in your SuggestOracle. In that case, you don't have to do anything, the ID will be set in the text box upon selecting a suggestion.(e.g. the "replacement string" is an email address, and the display string also contains the full name, the oracle using both the full name and email address for providing suggestions)--To view this discussion on the web visit https://groups.google.com/d/
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.msg/google-web-toolkit/-/ .Ldxgth8ifd0J
To post to this group, send email to google-we...@googlegroups.com .
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com .
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en .
--
Deepak Singh
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/cGP5gBfv5soJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment