Skip to content

Instantly share code, notes, and snippets.

@ColinFay
Created July 18, 2019 11:53
Show Gist options
  • Save ColinFay/a144b1c0fdf386b914e83fe04155a143 to your computer and use it in GitHub Desktop.
Save ColinFay/a144b1c0fdf386b914e83fe04155a143 to your computer and use it in GitHub Desktop.
Demo of event from right click in shiny
library(shiny)
ui <- function(request){
tagList(
tags$script(
"$(function(){
$(this).bind('contextmenu', function (e) {
e.preventDefault()
Shiny.setInputValue('plop', Math.random());
});
});"
)
)
}
server <- function(input, output, session){
observeEvent( input$plop , {
print(input$plop)
})
}
shinyApp(ui, server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment