Gmaps4rails : map not showing when loaded dynamically
-
27-10-2019 - |
Question
When I display a map using Gmaps4rails through a Jquery call ($('#id').load(/xyz)
), the map is not shown (a blank area is shown instead).
This page : https://groups.google.com/group/Google-Maps-API/browse_thread/thread/02710b15f3d76ec2/67413d33e7fd0e74?hl=en suggests calling map.reloadMap
once the page has been loaded, however I don't know the id of the element that should be called. The gmaps4rails documentation only mentions the id of the div containing the map and reading the source didn't help.
How can this be solved ?
Solution
Fyi, I've updated the source code. I especially commented the js file.
The map itself is stored in the following js variable:
Gmaps4Rails.map
But glad you found a solution to your problem ;)
OTHER TIPS
Solution : load the empty map in the main frame of the page, and update it dynamically with Gmaps4Rails.replace_markers(json)
.