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).
Comment | File | Size | Author |
---|---|---|---|
#7 | gmap-fix-duplicate-results-2160595-7.patch | 662 bytes | valentin schmid |
Comments
Comment #1
JKingsnorth CreditAttribution: JKingsnorth commentedUpdated 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).
Comment #2
f0ns CreditAttribution: f0ns commentedI have the exact same issue!
Comment #3
valentin schmid CreditAttribution: valentin schmid commentedSame issue here with
https://code.google.com/p/google-maps-utility-library-v3/source/browse/t...
as well with
https://code.google.com/p/google-maps-utility-library-v3/source/browse/t...
.
Comment #4
valentin schmid CreditAttribution: valentin schmid commentedCould this be realted to this Bug?
https://www.drupal.org/node/1958786
Comment #5
willfoley CreditAttribution: willfoley commentedI'm also having this issue; anyone having any luck with a solution?
Comment #6
doubouil CreditAttribution: doubouil commentedCustomized 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 :
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.
Comment #7
valentin schmid CreditAttribution: valentin schmid commentedDoubouil's fix works like a charm for me (with markerclustererplus).
Just made a patch of the fix.
Thank you doubouil!
Comment #8
malberts CreditAttribution: malberts commentedThe patch in #7 also fixes this for me using AJAX filters and MarkerClusterer.
Comment #9
sumitmadan CreditAttribution: sumitmadan at QED42 commentedPatch works great. Moving to needs review.
Comment #10
DrIPA CreditAttribution: DrIPA commented#6 works great, thanks!
Comment #11
podarokThanks, merged.
Comment #14
ngocketit CreditAttribution: ngocketit commented#7 works. Thanks!