PDA

View Full Version : InfoWindow Not Showing for Polygons



Morescratch
30 Jan 2012, 5:16 PM
Hi all,

I am loading JSON data from a remote service and stuffing it into a store based on a really simple model. I am doing this after maprender is fired. In the load event of the store I am doing the following:



var paths = [];

for (var i = 0; i < h.data.geometry.coordinates.length; i++){
var path = [];
for (var j = 0; j < h.data.geometry.coordinates[i].length; j++){
var ll = new google.maps.LatLng(
h.data.geometry.coordinates[i][j][1], h.data.geometry.coordinates[i][j][0]);
path.push(ll)
}
paths.push(path);
}

polygon = new google.maps.Polygon({
path: paths,
title : h.data.title,
map: map
});

var infowindow = new google.maps.InfoWindow({
content: "Insert content here..."
});

google.maps.event.addListener(polygon, 'mousedown', function() {
infowindow.open(map, polygon);
});


The infowindow does not show when I click on the polygon. I tried the 'click' event too. Any ideas?

Thanks!

mitchellsimoens
31 Jan 2012, 11:21 AM
Have you tried any of the touch events?

Morescratch
1 Feb 2012, 6:17 AM
Can you provide an example? I am using the sample code provided and it doesn't work either. Any pointers would be helpful. Thank you for your help!