Skip Navigation

[Resuelto] How do I set clusterClick?

This support ticket is created hace 2 años, 1 mes. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por chrisH-10 hace 2 años.

Asistido por: Waqar.

Autor
Mensajes
#2484785

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?
enlace oculto
User: flywheel
Pass: chivalrous-victory

#2485929

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

#2485999

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.`);
      });
}
#2486001

My "Final reply" was not posted previously. Let's see if this one posts...