Z. Zhang
Z. Zhang

Reputation: 501

R Shiny Set SelectizeInput default value as NULL

I tried to have below code working. But the default value of the selectizeInput widget was not NULL as I expected. Before when I allowed multiple input the default setting was working (as NULL). But I will need a single select input this time. Anyone has suggestions?

       selectizeInput("request","Select Existing Request",
               choice = unique(fileNames),multiple = FALSE,
               selected = NULL)

Upvotes: 4

Views: 7557

Answers (1)

Gopala
Gopala

Reputation: 10483

Try this one:

library(shiny)

fileNames = c('a', 'b', 'c', 'd', 'e')

ui <- fluidPage(
  selectInput("request","Select Existing Request",
                 choice = c('Choose a File Name' = '', unique(fileNames)), multiple = FALSE,
                 selected = NULL)
)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

Upvotes: 6

Related Questions