With the recommended update to bindEvent as of Shiny 1.6.0,
I am trying to do create a multi-event listener with bindEvent. e.g.
observe({}) %>% bindEvent(??, ignoreInit = T, ignoreNULL=FALSE)
Here are the input methods with observeEvent & observe:
observeEvent(c(input$a,input$b),{code})
or
observe({input$a; input$b; code})
both of these above options error out with bindEvent. A work around could be bindCache but that does not update if the inputs do.
Thoughts?
demo code (thanks @Zearpex):
library(shiny)
ui <- fluidPage(
numericInput("a", "Input A", value = 1),
numericInput("b", "Input B", value = 2),
verbatimTextOutput("output")
)
server <- function(input, output, session) {
observe({
output$output <- renderPrint({
cat("Something changed: a~", input$a, " or b~", input$b)
})
}) %>% bindEvent(? __ ?, ignoreInit = T, ignoreNULL=FALSE)
}
shinyApp(ui, server)
Edits: Clarity & demo code
after some testing, the following method does actually work. My error was else where.
%>% bindEvent(c(input$a, input$b), ignoreInit = T, ignoreNULL=FALSE)