Overriding url construction for goog.ui.AutoComplete.RichRemote

32 views
Skip to first unread message

Paul Davis

unread,
Jan 4, 2011, 2:09:23 PM1/4/11
to closure-lib...@googlegroups.com
I was having trouble finding out how to override the parameter names used in building the url.

I implemented this way (it works but, it just doesn't seem right):

var ac = new goog.ui.AutoComplete.RichRemote("http://www.myserver.com/typeahead.json", input);
ac.matcher_.buildUrl = function(uri, token, maxMatches, useSimilar, opt_fullString) {
   var url = new goog.Uri(uri);
   url.setParameterValue('name', token);
   console.log(url.toString());
   return url.toString();
};

Any advice?

xiaoxiao

unread,
Jan 19, 2011, 2:14:01 AM1/19/11
to Closure Library Discuss
It's better to create a subclass from goog.ui.AutoComplete.RichRemote
and override buildUrl by your own.
Reply all
Reply to author
Forward
0 new messages