View Full Version : Mouse click on Google Marker

18 Apr 2011, 12:18 PM
I've created some Markers, and I can see them on my map.

I've attached click listeners but it looks like they are not triggered. I've read that on different phones I need to listen for different events (I tried click, mousedown, mouseup, etc..), but I had no luck. I'm testing it inside Safari on my Mac and on an iPhone 4 simulator.

if (status == google.maps.GeocoderStatus.OK) {
var marker = new google.maps.Marker({
map: iTerme.mapPanel.map,
position: results[0].geometry.location,

google.maps.event.addListener(marker, 'click', function() {
alert("clicked " + iTerme.Places[i].nome);

} else {
alert("Error: " + status);

What am I doing wrong?


18 Apr 2011, 3:22 PM
could it be because I have the map inside a panel (the mapPanel obj in the script above) and that panel gets the click but doest not propagate it to its children map?

19 Apr 2011, 12:53 AM
This is a bug in the current version. I found this solution on another post (I don't have time to find that post again) so credits should go to the original user.

Add this before your application code and the problem should be fixed, at least for now until Sencha guys will fix this.

Ext.gesture.Manager.onMouseEventOld = Ext.gesture.Manager.onMouseEvent;
Ext.gesture.Manager.onMouseEvent = function(e) {
var target = e.target;

while (target) {
if (Ext.fly(target) && Ext.fly(target).hasCls('x-map')) {

target = target.parentNode;

this.onMouseEventOld.apply(this, arguments);

19 Apr 2011, 2:47 AM
I owe you big time!!

I put that code (nice workaround by the way, cheers to the original poster) before the initialization of my application and now I'm able to react to clicks. :D

5 Jun 2011, 2:54 AM

Thanks for the code, it helped me out :)

5 Jun 2011, 3:26 AM
hello, i have same bug
i use mouseover (or enter) and it work fine