如何在闪亮的开始时让下拉框为空
How to get the drop box empty at the start in shiny
我使用下拉框显示三个选项,
selectInput("select", label = h5("Choose Annotation DB"),
choices = list("h10kcod.db"="h10kcod","h20kcod.db"="h20kcod","hwgcod.db"="hwgcod")),
selected = NULL)
但是它总是在已经选择的下拉框中有第一个选择,但是我有兴趣让下拉框为空(没有选择)。我应该怎么做。谢谢
你好看看这个例子:
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)
我使用下拉框显示三个选项,
selectInput("select", label = h5("Choose Annotation DB"),
choices = list("h10kcod.db"="h10kcod","h20kcod.db"="h20kcod","hwgcod.db"="hwgcod")),
selected = NULL)
但是它总是在已经选择的下拉框中有第一个选择,但是我有兴趣让下拉框为空(没有选择)。我应该怎么做。谢谢
你好看看这个例子:
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)