[Here Maps Reactive Library] Custom Markers onClick
here-maps-reactive-library
Forge component by Mukesh Singh

Hi,

I am trying out Here Maps Reactive Library to see if this can be an alternative option. I have successfully populated the map with my custom markers from a database.

Now, I want to display a custom block or popup window as container for the information of the markers.

Is there a way I can handle on clicks of the markers?

Hope someone can help :)

Solution

I manage to make a workaround on this one.

Here's what I did:

Since this Forge component instantiates a tap event on all of the markers I remove that line on the OLM of the component.

First, I opened the HereMapsReactiveLibrary component and gone to the Logic Tab. I opened the AddMarker action in the MapActions folder inside Client Actions.

Then, I commented line 13-23 on the AddMarker Javascript inside the AddMarker action because these are the ones that instantiates event listeners to all markers which shows an InfoBubble.


On my app module, I added an Event_MapInitialized event to handle the initialization of the map.

Inside MapInitialized Event Handler action, I created a JS that'll add event listener to all markers inside the Here map. 

AddEventListener JS. The for loop is the one that searches for generated markers inside the instantiated map then adds event listener to every one of them. Then I made the event to trigger the MarkerOnClick client action on my module. :


The MarkerOnClick has an Input parameter which catches the marker Id. And from there, I can now use that Id to fetch data and display it on custom windows or popups, instead of just an InfoBubble.


I am a newbie on outsystems and have been using the platform for only 2 months now so I'm not sure if my workaround is the correct implementation but the solution worked for me.

Cheers!

Hey Gab,

That's correct you can modify this way if it serves you requirement.

Anyways if you need more help to add new features or any help. 

Please let me know I can help you with that.

Thanks Mukesh.

These component is really a big help if someone is looking for an alternative for Google maps plugin since gmaps are pricey as of this moment while here maps has Freemium option.

Best Regards!

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