OhGoogleMapFormTypeBundle icon indicating copy to clipboard operation
OhGoogleMapFormTypeBundle copied to clipboard

Bug if we use it in a sonata admin tab

Open SebBareyre opened this issue 11 years ago • 7 comments

ohgoogle

Hello, I have a bug when i use this bundle in a sonata admin tab. Could you help me to solve this problem.

Thanks Seb

SebBareyre avatar Nov 11 '14 17:11 SebBareyre

@SebBareyre Check that the maps container has a set height and size when it's loaded into the page. This usually happens when the container doesn't have a fixed size or is hidden when the js is loaded.

ollietb avatar Dec 01 '14 16:12 ollietb

I have set width and height and it doesn't work either. I think the problem come from the map is located in a hidden tab at page loading... no ?

SebBareyre avatar Jul 10 '15 14:07 SebBareyre

@SebBareyre yes, this will happen if you try to load the map before it is visible

ollietb avatar Jul 24 '15 13:07 ollietb

ok and how we could solve that ?

SebBareyre avatar Jul 27 '15 13:07 SebBareyre

up

SebBareyre avatar Nov 09 '15 17:11 SebBareyre

@SebBareyre After showing tab with map you need to trigger following code:

var center = map.getCenter(); 
google.maps.event.trigger(map, 'resize'); 
map.setCenter(center);

This will refresh map and everything should be fine then. Middle line is significant here, other two are only to ensure center of the map will stay the same.

jan-j avatar Nov 23 '15 16:11 jan-j

Any idea to trigger this code on click tab in sonataadmin?

xmon avatar May 23 '16 21:05 xmon