这是我在 stackoverflow 上的第一个问题。我在闪亮(1.0.5)中遇到模块和 renderUI 的问题。
当我在中使用 renderUI 时
#### Main Part
ui <- bootstrapPage(
uiOutput("DynamicContent")
)
server <- function(input, output,session) {
S_A <- selectInput("S_A_Input" ,"Change Me for print message",choices=1:3 )
output$DynamicContent <- renderUI({
tagList(S_A)
})
observe({
print(input$S_A_Input)
})
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
那么更改 selectInput 将导致更改 input$S_A_Input,因此会发生打印。没关系。
另一方面,如果我使用模块,则 input$S_A_Input 似乎不起作用:
### Module Part
Module_YYY_Server <- function(input, output, session){
S_A <- selectInput("S_A_Input" ,"Change Me for print message",choices=1:3 )
output$DynamicContent <- renderUI({
tagList(S_A)
})
observe({
print(input$S_A_Input)
})
}
Module_YYY_Ui <- …Run Code Online (Sandbox Code Playgroud)