谷歌地图API V3 - 反正检索结果自动完成,而不是下拉渲染呢? [英] Google Maps API V3 - Anyway to retrieve Autocomplete results instead of dropdown rendering it?
问题描述
我需要渲染 google.maps.places.Autocomplete
的结果在一个自定义的方式,而不是默认的下拉菜单。
有什么办法,我可以使用谷歌地图API V3来检索自动完成的同样的信息,但在每个请求,而不是API的阵列做渲染我?
谢谢!
PS1:
我不知道我可以使用 google.maps.places.PlaceSearchRequest
。但是,不同于自动完成,这限制了我的位置。它不能被用于全球搜索
- HTTP://$c$c.google。 COM /的API /地图/文档/ JavaScript的/的reference.html
- HTTP://$c$c.google。 COM /的API /地图/文档/地/ index.html的
PS2:
默认的方式我(目前)使用自动完成限制我。我必须通过输入元素,和API呈现下拉列表中,这是我不想要的。
VAR自动完成,input_el,place_changed_trigger_func;
input_el =<输入组件&gt ;;
place_changed_trigger_func =功能(){
VAR地方= autocomplete.getPlace();
//你想与任何地方
};
自动完成=新google.maps.places.Autocomplete(input_el,{类型:地缘code]});
google.maps.event.addListener(自动完成,'place_changed',place_changed_trigger_func);
我相信这是@jegnag指包括链接。
<一个href=\"https://developers.google.com/maps/documentation/javascript/places-autocomplete#place_autocomplete_service\" rel=\"nofollow\">https://developers.google.com/maps/documentation/javascript/places-autocomplete#place_autocomplete_service
您可以访问的结果数组(除地方建议的搜索字词),你甚至可以添加自己的定制结果给这个数组,不过和一切显示你选择。
I need to render the results of google.maps.places.Autocomplete
in a custom way, instead of the default drop down menu.
Is there any way I can use the Google Maps API V3 to retrieve the same info of Autocomplete, but in an Array per request instead of the API do the rendering for me?
Thanks!
PS1:
I wondered I could use the google.maps.places.PlaceSearchRequest
. But, differently from Autocomplete, it restricts my location. It cannot be used to search worldwide.
- http://code.google.com/apis/maps/documentation/javascript/reference.html
- http://code.google.com/apis/maps/documentation/places/index.html
PS2:
The default way I am (currently) using Autocomplete restricts me. I must pass an input element, and the API renders the dropdown, which I do NOT want.
var autocomplete, input_el, place_changed_trigger_func;
input_el = <an input element>;
place_changed_trigger_func = function() {
var place = autocomplete.getPlace();
// do whatever you want with place
};
autocomplete = new google.maps.places.Autocomplete(input_el, {types: ["geocode"]});
google.maps.event.addListener(autocomplete, 'place_changed', place_changed_trigger_func);
I believe this is the link that @jegnag meant to include.
You can access the array of results (places in addition to suggested search terms), you can even add your own custom results to this array, and display everything however you choose.
这篇关于谷歌地图API V3 - 反正检索结果自动完成,而不是下拉渲染呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!