Hello all,
We are trying to have it so there is a selectInput() dropdown menu that is the same across all tabs. We have been trying to use updateSelectInput() and observeEvent() in server.R but we are having difficulty getting it to update. Code looks something like this:
#ui.R
navbarPage(
..
tabPanel(
..
selectInput("select1", width=3, label=h3("Select dataset"), choices = list("a" = "/path1", "b" = "/path2, "c = /path3")
..
),
tabPanel(
..
selectInput("select2", width=3, label=h3("Select dataset"), choices = list("a" = "/path1", "b" = "/path2, "c = /path3")
..
)
)
#server.R
shinyServer(function(input, output, session){
#neither input$select* updates the other
observeEvent(input$select1, function(){
updateSelectInput(session, "select2", selected=input$select1)
})
observeEvent(input$select2, function(){
updateSelectInput(session, "select1", selected=input$select2)
})
#rest of code that uses input$select1
..
})
Would anyone know how to get around this? Or maybe if there is a way to not have the copy the same selectInput() code in ui.R with just different inputId? Thanks.
Daniel