You probably just want content.join(''), since you're pushing <li>s to the
array.Chris On Tue, May 3, 2011 at 11:26 AM, Dan <[email protected]> wrote: > Got it working! thanks everyone for all the help! rough-final snippet > is below if it will help anyone in the future.. displays list of > markers in cluster by id and title upon cluster click... > > // Define the marker clusterer > var clusterOptions = { > zoomOnClick: false } > var markerCluster = new MarkerClusterer(map, markers, > clusterOptions); > > // Listen for a cluster to be clicked > google.maps.event.addListener(markerCluster, 'clusterclick', > function(cluster) { > var center = cluster.getCenter(); > var size = cluster.getSize(); > var id = []; > var title = []; > var content = []; > > > var clickedMarkers = cluster.getMarkers(); > > for (var i = 0; i < clickedMarkers.length; i++) { > var id = clickedMarkers[i].id; > var title = clickedMarkers[i].title; > content.push("<li><a href=detail.php?id=" + id + "&referer=map>" + > title + "</a></li>"); > } > > infoBubble.setContent("<h2>Select an Event</h2><ul>" + > content.join("<br>") + "</ul>"); > infoBubble.setPosition(center); > infoBubble.open(map); > > }); > > On May 3, 2:05 am, Chris Broadfoot <[email protected]> wrote: > > You're only showing the id of the final marker in the "clickedMarkers" > > array. > > > > Instead, you probably want to buffer up all the ids in an array and then > > separate them with <br>s. Something like this: > > > > google.maps.event.addListener(markerCluster, 'clusterclick', > > function(cluster) { > > var center = cluster.getCenter(); > > var size = cluster.getSize(); > > var content = []; > > > > var clickedMarkers = cluster.getMarkers(); > > > > for (var i = 0; i < clickedMarkers.length; i++) { > > content.push(clickedMarkers[i].id); > > } > > > > infoBubble.setContent(content.join('<br>')); > > infoBubble.setPosition(center); > > infoBubble.open(map); > > > > }); > > > > --http://twitter.com/broady > > -- > 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. > > -- http://twitter.com/broady -- 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.
