How to get an empty box at the beginning in shiny
I am using drop box to display three options,
selectInput("select", label = h5("Choose Annotation DB"),
choices = list("h10kcod.db"="h10kcod","h20kcod.db"="h20kcod","hwgcod.db"="hwgcod")),
selected = NULL)
But it always has the first choice in the already selected window, but I wonder if the empty box is empty (no one is selected). How should I do it. Thanks to
+3
source to share
1 answer
Hi, take a look at this example:
library("shiny")
ui = fluidPage(
# method 1 : put an empty element "" in your list
selectInput("select", label = h5("Choose Annotation DB"),
choices = list("", "h10kcod.db"="h10kcod","h20kcod.db"="h20kcod","hwgcod.db"="hwgcod")),
# method 2 : use selectizeInput and the placeholder option
selectizeInput("select", label = h5("Choose Annotation DB"),
choices = list("h10kcod.db"="h10kcod","h20kcod.db"="h20kcod","hwgcod.db"="hwgcod"),
options = list(placeholder = 'A placeholder',
onInitialize = I('function() { this.setValue(""); }')))
)
server = function(input, output) {
}
shinyApp(ui = ui, server = server)
+4
source to share