Using the example below, I am trying to figure out a way to add functionality to my shiny app such that the following works:
You can use input$map_marker_click
and updateSelectInput()
:
Edit: Added functionality that stations can be deleted from selectInput()
as suggested by OP in the comments.
(Dont forget to add session
to your sever function).
observeEvent(input$stations,{
updateSelectInput(session, "stations", "Click on Station",
choices = levels(factor(quakes$stations)),
selected = c(input$stations))
})
observeEvent(input$map_marker_click, {
click <- input$map_marker_click
station <- quakes[which(quakes$lat == click$lat & quakes$long == click$lng), ]$stations
updateSelectInput(session, "stations", "Click on Station",
choices = levels(factor(quakes$stations)),
selected = c(input$stations, station))
})
However, this functionality is partly overwritten by the popup event(?). As i see it there is an inner blue circle (darker blue) that if clicked produces the popup. However, the input$map_marker_click
only works if you click the outer (light blue) circle. I would report it as a bug,...