[OutSystems Maps] Close current marker popup when clicking new marker
Forge component by OutSystems R&D
Application Type

I noticed the marker popups do not close automatically when you click another (custom) marker. You need to explicitly close the popup yourself. 

However, the 'default' markers in the Google Map (for example restaurants) do indeed close automatically when clicking another one.

If there any option or action we miss when adding/clicking our own markers?

Hello @Geertjan Jacobs,

Thanks for bringing this subject to the discussion.

At the moment, that is not available on the OutSystems Maps component. Our team is going to analyze what you suggested and we will try to give you the best solution, as soon as possible. 

Right now, I would suggest the following workaround (.oml attached):

1) On your markerPopups add the handler for the OnClick event.

2) Inside the handler, add a new JS Block into the flow.

3) The JS Block should have the code that will close all the popups from the Map. The method is optimized to only close the popups when they are opened. 


    if (marker.hasPopup) marker.closePopup();


You can also close the popup for a specific marker by using the following code:


Please bear in mind that we didn't make all the necessary tests to ensure that it will work on all edge cases. We are continuously working to provide more API methods, so I suggest you keep tuned.

Hope this answer is useful.

Best regards,

Tiago Pereira


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.