[LeafletJS - Reactive] Mouse Events when markers etc. are added via AddMarker Action.

Forge Component
(5)
Published on 22 Jun by Vincent Koning
5 votes
Published on 22 Jun by Vincent Koning

The demo shows how to implement mouse events (specifically on click events) when the markers are added directly into the map with initialised events on load.

If I was to use a button to add these (and not storing them in a marker table), how would I go about this?


For example in the .oml I have attached how would I add a basic action (e.g. the ShowMessage Action I've created) to work when i click that marker?

Hi Gavin,

I'll take a look, hopefully today, at your issue.

Solution

Hi Gavin,

A meeting got postponed so I had time to look at your issue. 

The issue you are facing is that events are not supported via the available Client Actions. This is due to the fact that I can't supply a return function that is needed for the events. If you want to use events you will need to add the marker via Markers input parameters of the Leaflet widget itself. This will autoupdate itself if the supplied list is changed.

I changed your oml to reflect the needed changes. I hope this will help you. 

Greetings,

Vincent

Solution

Vincent Koning wrote:

Hi Gavin,

A meeting got postponed so I had time to look at your issue. 

The issue you are facing is that events are not supported via the available Client Actions. This is due to the fact that I can't supply a return function that is needed for the events. If you want to use events you will need to add the marker via Markers input parameters of the Leaflet widget itself. This will autoupdate itself if the supplied list is changed.

I changed your oml to reflect the needed changes. I hope this will help you. 

Greetings,

Vincent

Vincent,

Thank you very much for looking into this and the revised demo. I've been through it this morning and will be able to replicate that inside our main solution.

Thanks for all your help with this, its a fantastic module!


Hi Gavin,

Glad to be of help and thank you very much for the compliment. If you like you could leave a review about this component: https://www.outsystems.com/forge/Component_Reviews.aspx?ProjectId=6907

Greetings,

Vincent