How do you use values obtained from a renderUI element in a reactive wrapper?
i.e. My code:
CompanyNames <- sqlQuery(connection, \"SELECT Companyn
You would refer to the elements by their id for example input$compName
. As a contrived example here
is a simple shiny app with two selectInput's. The second selectInput
choices depend on the value of the first. Referencing the output of widgets created by renderUI
is no different from referencing the same widgets if they had been in UI.R from the beginning:
library(shiny)
myDF <- data.frame(A = 1:4, B = 3:6, C = 6:9, D = 10:13)
runApp(
list(
ui = fluidPage(
uiOutput("myList"),
uiOutput("myNumbers")
)
, server = function(input, output, session){
output$myList <- renderUI({
selectInput("compName", "Company Name:", LETTERS[1:4])
})
output$myNumbers <- renderUI({
selectInput("compNo", "Product Line:", myDF[, input$compName])
})
}
)
)