Tell us what you are trying to do?
I have a map with custom clusters. I would like to add a listener for the clusters so I can show a list of results below the map based on the markers it resolves to.
Is there any documentation that you are following?
https://toolset.com/documentation/programmer-reference/maps/customizing-cluster-markers-with-javascript-functions/ .
That works fine for the custom styles and renderer. By the Google documentation I should also be able to set onClusterClick along with the other options by you don't seem to expose or apply this. I also did not find a way to access the ClusterRenderer instance to use addListener('clusterClick"...)
What is the link to your site?
lien caché
User: flywheel
Pass: chivalrous-victory
Hi,
Thank you for contacting us and I'd be happy to assist.
I did some research and couldn't find any event listener specific to Toolset Maps, for this.
Can you test the approach suggested in this forum thread:
https://stackoverflow.com/questions/60264796/detect-click-on-cluster-marker
regards,
Waqar
I had set this to resolved along with the solution. Unfortunately it appears to have been lost. I had a longer writeup but the basic solution is pretty easy:
jQuery( document ).on( 'js_event_wpv_addon_maps_init_map_completed', function( event, data ) {
let clusterer = WPViews.view_addon_maps_clusters['map-homes'];
clusterer.addListener("clusterclick", (e) => {
console.info(`This cluster contains ${e.markers_.length} items.`);
});
}
My "Final reply" was not posted previously. Let's see if this one posts...