egeloen / IvoryGoogleMapBundle

Google Map API v3 integration for your Symfony2 project.
https://github.com/egeloen/ivory-google-map
MIT License
217 stars 152 forks source link

infoWindow problem #3

Closed mbajur closed 13 years ago

mbajur commented 13 years ago

I have a problem with displaying infoWindow with markers.

Full description of my problem is posted here: http://stackoverflow.com/questions/7311629/ivorygooglemap-cant-display-infowindow

Thanks, Mike

egeloen commented 13 years ago

This functionality doesn't exist natively. If you want to open an info window with a click event on a marker, you need to use the ivory_google_map.event service. This service allow you to generate all events you want.

In your case, the event is :

$clickEvent = $this->get('ivory_google_map.event');
$clickEvent->setInstance($marker->getJavascriptVariable());
$clickEvent->setEventName('click');
$clickEvent->setHandle(sprintf('function(){%s.open(%s, %s);}',
    $infoWindow->getJavascriptVariable(),
    $map->getJavascriptVariable(),
    $marker->getJavascriptVariable()
);

$map->getEventManager()->addEvent($clickEvent);
mbajur commented 13 years ago

Oh, great, thank you for your help! :) I thought $marker->setInfoWindow() will take care of it. Maybe it's a good idea to put above example in the doc ? It can be quite helpfull for new IvoryGoogleMap users

LucaColombi commented 8 years ago

Hello,

What is the contest to use for'$this'? Any news about this functionality as native?