diff --git a/frontend-js/src/main/js/map/CustomMap.js b/frontend-js/src/main/js/map/CustomMap.js index 2d53032ebd95fbc642fc43d1e6f9b82b7b5e1883..088a88a11021ce1bef363dddb88ccc5bec3d1312 100644 --- a/frontend-js/src/main/js/map/CustomMap.js +++ b/frontend-js/src/main/js/map/CustomMap.js @@ -857,15 +857,15 @@ CustomMap.prototype.renderOverlayCollection = function(overlayCollection, fitBou } }); }).then(function() { - - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; + return Promise.each(elements, function(element) { var infoWindow = self.getInfoWindowForIdentifiedElement(element); if (infoWindow !== null && infoWindow !== undefined) { - self.retrieveOverlayDetailDataForElement(element, infoWindow.getOverlayFullViewArray()); - self.updateInfoWindowForIdentifiedElement(element); + return self.retrieveOverlayDetailDataForElement(element, infoWindow.getOverlayFullViewArray()).then(function() { + self.updateInfoWindowForIdentifiedElement(element); + }); } - } + }); + }).then(function() { if (elements.length > 0 && fitBounds) { for ( var mapId in boundsArray) {