addEasyButton() call R code rather than JS

leaflet

#1

Hi there,

I'd like to add a EasyButton to my Leaflet map, however I want it to run methods from my R code, not JavaScript code. Is there a way to do this? I don't want to have a Shiny button as this doesn't fit with the rest of the UI.

For example:

addEasyButton(easyButton(icon="fa-tint", onClick=myMethodHere()))

Rather than:

addEasyButton(easyButton(icon="fa-tint", onClick=JS(some java script)))

Many thanks!


#2

you can send a message from JS to R to achieve this, see scenario 2


#3

Awesome, thanks for the response! I'll give it a go!


#4

Many thanks, this worked a treat!