how can I give On click property to a particular marker or a particular polyline?

On the click of particular polyline, all the markers data connecting the polyline should be displayed in the sidebar in list form sequentially, can anyone guide me on how to implement this kind of functionality?

mvp_badge
MVP

Hi Riya,

For the mentioned use-case, you need to register click event handler to the created polyline using the below-mentioned JS. 

JS Snippet:

window[$parameters.PolylineName].on('click', function (e) {
    $actions.GetLocation(JSON.stringify(e.latlng));
    L.DomEvent.stopPropagation(e);
});

See this demo screen (first click the AddMarker then AddPolyline Btn): LeafletJS_Polyline_ClickEvtHandler

Refer to the attached oml

I hope this helps you!


Kind regards,

Benjith Sam

LeafletJS_Polyline_ClickHandler.oml

Hi, Benjith I have cloned the oml and the application is not working as expected . the latitude and longitude are not changing on screen after clicking on marker or polyline,  kindly guide also the popup is not showing on click too 

mvp_badge
MVP

Hi Riya,

Could you please elaborate a bit, what exactly is not working?? are you encountering any exceptions etc?

Note that the shared oml does have a few dependencies from the Leaflet forge component modules and instead of cloning (I'm a bit confused here) refer to the implementation from the shared oml and try to implement the same in your project application module.

I hope the demo screen  LeafletJS_Polyline_ClickEvtHandler implementation is your expectation?

Regarding to the marker popup implementation please refer to this link: https://www.outsystems.com/forums/discussion/77894/how-can-i-display-information-when-user-clicks-on-markers-on-map/#Post322270

I hope this helps you!


Kind regards,

Benjith Sam

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