Gmaps4rails: map does not appear on dynamic loading

When I display a map using Gmaps4rails through a jQuery call ( $('#id').load(/xyz) ), the map does not appear (an empty area is displayed instead).

This page: https://groups.google.com/group/Google-Maps-API/browse_thread/thread/02710b15f3d76ec2/67413d33e7fd0e74?hl=en suggests calling map.reloadMap after loading the page, however I do not know the identifier that should be called . The gmaps4rails documentation only mentions the div identifier containing the map, and reading the source did not help.

How can this be solved?

+1
source share
2 answers

Fyi, I updated the source code. I especially commented on the js file.

The map itself is saved in the following js variable:

 Gmaps4Rails.map 

But I'm glad that you found a solution to your problem;)

+3
source

Solution: load a blank map into the main frame of the page and dynamically update it using Gmaps4Rails.replace_markers(json) .

+1
source

All Articles