I'm experiencing an issue with GMap when using a map with an AJAX exposed filter. In the first instance the map displays all the contents of the list perfectly, but when an exposed filter is applied - on a View with AJAX enabled - the map displays every location twice (ie: two locations in exactly the same place).

Steps to recreate the issue:

Create a new display (block or page) that displays some content with an associated location on a GMAP. Add an exposed filter to it. Ensure that 'All values' are being displayed.

Turn on AJAX in the advanced settings.

Test the View. Initially it should display fine: a filter, a map and a list of locations on the map.

However, if you apply the exposed filter (with AJAX enabled) the map displays two locations in each place. This is particularly noticeable when markerclusterer is enabled (it may not be apparent otherwise).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JKingsnorth’s picture

Title: GMap attachment shows duplicate results when AJAX is enabled and an exposed filter is applied » GMap shows duplicate results with AJAX exposed filters
Issue summary: View changes

Updated the issue summary, it's actually more common. Duplicate results are displayed in any map View when an exposed filter is applied with AJAX (not just when the map is an Attachment).

f0ns’s picture

I have the exact same issue!

valentin schmid’s picture

valentin schmid’s picture

Could this be realted to this Bug?
https://www.drupal.org/node/1958786

willfoley’s picture

I'm also having this issue; anyone having any luck with a solution?

doubouil’s picture

Customized markers are loaded with an icon loader. The function that change the marker also adds it to the map by triggering the "addmarker" event if I understand correctly. In doing so, it doesn't check if the marker already has an attached gmap marker, causing the duplicate. You need custom markers to trigger this bug, since default ones are not loaded with the icon loader.

in markerloader_static.js, simply change :

obj.change('addmarker', -1, marker);

To :

if( marker && marker.marker == undefined ) {
 obj.change('addmarker', -1, marker);
}

And you'll have no duplicate. I only tested it with the same marker & marker content before and after filtering. It may broke your code if your marker rely on something changed after filters are applied.

valentin schmid’s picture

Doubouil's fix works like a charm for me (with markerclustererplus).
Just made a patch of the fix.
Thank you doubouil!

malberts’s picture

The patch in #7 also fixes this for me using AJAX filters and MarkerClusterer.

sumitmadan’s picture

Status: Active » Needs review

Patch works great. Moving to needs review.

DrIPA’s picture

#6 works great, thanks!

podarok’s picture

Status: Needs review » Fixed

Thanks, merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ngocketit’s picture

#7 works. Thanks!