开发者

Reload/Refresh Google map

I want to reload google map with new markers when the user select an option from the select field.Please help me how to refresh/reload google map with new markers.

Right开发者_Python百科 now the store is getting reloaded from the change option the the select field. But the markers are not getting refreshed and are still showing the old results.

I'm trying :

mapToRefresh = Ext.getCmp("mapaSearch");
mapToRefresh.update(mapPositions[0]);//mapPosition is the new lat,long
mapToRefresh.rendered = false;
mapToRefresh.render();

But it's not working.i'm getting this error: Uncaught TypeError: Cannot read property 'ownerDocument' of null

Thanks


I had the same issue with the map. It would be much more simpler and efficient to clear the markers and update the map with the new markers on select change.

If you need to render the map the best way to achieve this is to destroy the map and recreate it again on select change.

Hope this helps.


This problem occurs when the site is connected to two google maps. And on another page of one of the map is not available. You must add it and hide...

Example:

var mapOptions = {
    zoom: 17,
    center: new google.maps.LatLng(59.938863, 30.311556),
     mapTypeControlOptions: {
    mapTypeIds: [google.maps.MapTypeId.ROADMAP,'map_style']
}
};

 var mapOptionsNew = {
zoom: 17,
center: new google.maps.LatLng(59.939119, 30.317952),
 mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP,'map_style']
  }
};

map = new google.maps.Map(document.getElementById('id-map'),apOptions);
mapNew = new google.maps.Map(document.getElementById('id-map1'),mapOptionsNew);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜