我正在尝试使用Shiny App来显示动态上下文,但我无法renderDataTable进入renderUi组件.下面是两个简单的可复制测试:第一个没有工作,第二个没有renderUi工作正常,当然.
这两者之间的概念差异是什么,为什么第一个不能工作Shiny?
这个不起作用:注意uiOutput myTable,包含两个无效组件,a selectInput和a renderDataTable,但只有selectInput渲染.
library(shiny)
runApp(list(
ui = fluidPage(
fluidRow(h2("where is the table?")),
uiOutput('myTable')
),
server = function(input, output) {
output$myTable <- renderUI({
fluidPage(
fluidRow(selectInput("test", "test", c(1,2,3))),
fluidRow(renderDataTable(iris))
)
})
}
))
Run Code Online (Sandbox Code Playgroud)
这是好的,既selectInput与renderDataTable呈现:
library(shiny)
runApp(list(
ui = fluidPage(
fluidRow(h2("where is the table?")),
fluidRow(selectInput("test", "test", c(1,2,3))),
fluidRow(dataTableOutput('myTable'))
),
server = function(input, output) {
output$myTable = renderDataTable(iris)
}
))
Run Code Online (Sandbox Code Playgroud)
如何让第一个场景有效?
谢谢.
易辉评论后的编辑(感谢易辉): …