Skip Navigation

[Gelöst] How do I set clusterClick?

This support ticket is created vor 2 Jahren. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von chrisH-10 vor 2 Jahren.

Assistiert von: Waqar.

Author
Artikel
#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?
versteckter Link
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...