[LeafletJS - Reactive] How to add onclick events for markers?

Forge Component
(4)
Published on 23 Apr by Vincent Koning
4 votes
Published on 23 Apr by Vincent Koning

Hi there,

I've used the leafletjs javascript library previously, but never interacted with it in outsystems.

How would I trigger a client action to happen on click of a marker...?

I know usually you would include .on('click', myfunction). I tried a few variations of this but could'nt get it to work.

Many thanks,


Gavin

Hi Gaving,


You have to write handler for OnClick Event given by the component.


For more details about event and handler you can visit below links if not done yet.

https://www.outsystems.com/learn/lesson/807/blocks-and-events/
https://success.outsystems.com/Documentation/11/Developing_an_Application/Design_UI/Reuse_UI/Use_Events_to_Propagate_Changes_From_a_Block_to_the_Parent


Hi Gavin,

Be sure to take a look at the demo. There are several demo's going into detail on how to handle events. Should you have any specific questions than please let me know.

Greetings,

Vincent

Vincent Koning wrote:

Hi Gavin,

Be sure to take a look at the demo. There are several demo's going into detail on how to handle events. Should you have any specific questions than please let me know.

Greetings,

Vincent


Hi Vincent, 

Demos would be brilliant! Where are they saved and I'll download them and have a look? 


Many thanks,

Gavin

Solution

Hi Gavin,

You can either download it from the Forge website via the download button;


or use the demo installation button in Service Studio. 

Under normal circumstances you get an "Install" button instead of a download button but since I'm already working on a new version I can't. 

Solution

Hi Vincent,

The demo is brilliant, and really useful in showing how this all works together. I've marked it as the solution because it does answer my question on adding onclick actions.

However, the markers I was adding were through a customised version of the add marker function where I add markers into featuregroups to display on the map. This was more practical for the app I'm trying to build - and how I would build it outside of outsystems. I tried tweaking this further to include the same structure (initialising events etc.), but still couldn't get it to work...

Any ideas?



Hi Gavin,

Perhaps it's best to create a new thread for this. And if you could create a small PoC that demonstrates your issue that would be really helpful. That way I can analyse you demand a better.

Greetings,

Vincent

Vincent Koning wrote:

Hi Gavin,

Perhaps it's best to create a new thread for this. And if you could create a small PoC that demonstrates your issue that would be really helpful. That way I can analyse you demand a better.

Greetings,

Vincent

Will do! Thanks again, your help is greatly appreciated.