2015-10-14 18 views
1

我试图在Shiny中显示值的下拉列表。但它似乎没有显示初始值。select(ize)输入在Shiny中不显示初始值

selectizeInput('id', label = "Year", choices = 
NULL, multiple=FALSE,selected="X2015",            options = list(create = 
TRUE,placeholder = 'Choose year')) 

year <- c("X2001","X2002","X2003","X2004","X2005","X2006","X2007","X2008", 
     "X2009","X2010","X2011","X2012","X2013","X2014","X2015","X2016", 
     "X2017","X2018")           

    updateSelectizeInput(session, 'id', choices = year, server = TRUE) 
+0

我从来没有用过'updateSelectizeInput'所以我不知道,但不应该有与一个'selected'参数初始值? http://shiny.rstudio.com/reference/shiny/latest/updateSelectInput.html – user5029763

+0

我相信这个问题已经在闪亮的开发版本中得到修复。请尝试'devtools :: install_github('rstudio/shiny')' –

+0

@ user5029763。将选中的选项添加到updateSelectizeInput工作。 –

回答

0

添加所选参数updateSelectizeInput设置默认

updateSelectizeInput(session, 'id', choices = year, server = TRUE,selected="2001")