I have simplified my shiny app as follow:
library(shiny)
library(shinythemes)
library(shinyBS)
ui <- fluidPage(
theme = shinytheme("flatly"),
navbarPage("Demo",
tabPanel("Home",
column(2,
selectInput(inputId = "s1",label = "select project",choices = c("1", "2", "3")),
uiOutput("sensor")
))))
server <- function(input, output,session){
output$sensor <- renderUI({
s = c(as.numeric((input$s1))^2,as.numeric((input$s1))^3)
selectInput("t1",label ="Select",choices = ifelse(input$s1 == "1",c("x1","x2"),s ),multiple = FALSE)
})
}
I expect to get the x1 and x2 in second dropdown if my first selection is 1, otherwise either 4 and 8 or 9 and 27 should be the expected values in second dropdown.
But surprisingly, what I'm getting is just one value to select in second dropdown : if 1 I'm getting just x1, if 2 I have just 4 and if 3 I have just 9 !!
why the selectInput is not updating properly ?

