I want two different events to trigger an observer. It has been suggested here that this should work. But it seems that this depends only on the second event.
observeEvent({
input$spec_button
mainplot.click$click
}, { ... } )
See an example.
ui <- shinyUI(bootstrapPage(
actionButton("test1", "test1"),
actionButton("test2", "test2"))
)
server <- shinyServer(function(input, output) {
observeEvent({
input$test1
input$test2
}, {
print('Hello World')
})
})
shinyApp(ui, server)
As soon as you press the test1 button, nothing will happen. If you press the test2 button, it prints on your console. After pressing the test2 button, pressing the test1 button prints a message. This is a weird behavior.
Another suggestion that was associated with was the use of
list(input$test1, input$test2)
That prints a message even without pressing buttons.
source
share