开发者

How can I extend autocomplete's source in the course of geocoding

I create an autocomplete field like that for the Google Maps. It's working, but I need to extend the address list with my own points (specifically with category). The autocomplete function's source option needs the extending:

  gc = new google.maps.Ge开发者_如何转开发ocoder();
  $(Element).autocomplete({
    source: function(request, response) {
      gc.geocode( {'address': request.term }, function(results, status) {
        response($.map(results, function(item) {
          return {
            label:  item.formatted_address,
            value: item.formatted_address,
            latitude: item.geometry.location.lat(),
            longitude: item.geometry.location.lng()
          }
        }))
      })
    },
    select: ...
  });

Any idea? Thank you in anticipation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜