Hi guys

I'm working on a project where I need to implement the MarkerClusterer
for the markers on the same location. That is already done, and big
thanks to the people who created the MarkerClusterer.

So what I want to do next is to open up an infowindow on the clusters
that displays a list with the titles of the markers in the cluster.
These titles needs to be clickable and open up the infowindow for the
clicked marker. It is all showing up nicely, but the problem I'm
facing is that i'm getting an error telling me that "clusterMarkers is
not defined" when I click the links.

I have seen elsewhere others using this piece of code to do the job,
but somehow I can't make it work:
google.maps.event.trigger(clusterMarkers[" + i + "], 'click'

Here's my code so far:

var markerCluster = new MarkerClusterer(map,allMarkers, {gridSize: 5,
zoomOnClick: false});
var clusterMarkers = [];

// Listen for a cluster to be cliced
google.maps.event.addListener(markerCluster, 'clusterclick',
function(cluster) {

var content = '';

// Get info about the clustered markers
clusterMarkers = cluster.getMarkers();

for(i=0; i<clusterMarkers.length;i++){
                        content += "<a href=
\"javascript:google.maps.event.trigger(clusterMarkers[" + i + "],
'click')\">" + clusterMarkers[i].title +  "</a><br />";
}

// Convert lat/long from cluster object to a usable MVCObject
var info = new google.maps.MVCObject;
info.set('position', cluster.center_);

var infowindow = new google.maps.InfoWindow();
infowindow.close();
infowindow.setContent(content);
infowindow.open(map, info);

I'm sorry that I don't have the project online so you can see it but I
hope you can help me out anyway.

Big thanks

/Martin


-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to