0
我正在使用renderUI()来显示动态UI。下拉列表框被动态更新,但是当我从下拉列表中选择一个特定的值时,它确实需要,但是会回落到列表中的第一个元素。为什么会发生?为什么它不能保持在选定的值。发布在动态renderUI中闪烁
ui.R
fluidRow(
column(3,
radioButtons("matchType", label = h3("Match type"),
choices = list("Test" = "Test",
"ODI" = "ODI",
"Twenty20" = "TT"),
inline=TRUE,
selected = "Test"),
uiOutput("players"),
uiOutput("functions")
),
server.R
testBatsman <- c("X","Y","Z")
odiBatsman <- c("XX","YY","ZZ")
funcs <- c("A","B","C")
funcsODITT <- c("AA","BB","CC")
output$batsmanPlot <- renderPlot({
# Include the list to display in the drop downs on choice of matchType
if(input$matchType == "Test"){
player = testBatsman
f = funcs
} else if(input$matchType == "ODI"){
player = odiBatsman
f = funcsODITT
}
output$players = renderUI({
selectInput('batsman', 'Columns',choices=player)
})
output$functions = renderUI({
selectInput('batsmanFunc', 'Column1',choices=f)
})
print(input$batsman)
analyzeBatsman(input$batsman,input$batsmanFunc,input$matchType)
虽然它能够动态地调整它返回到所选择的列表的第一个元素的2个下拉菜单。对于e,当 testBatsman( 'Z')和funcs中(' “(A”)。(X ')和funcs中C)它returing回testBatsman之前显示此简要'“ G
为什么会出现这种情况?我怎样才能使它留在选择的值?
感谢