【发布时间】:2017-09-21 22:26:20
【问题描述】:
我在我正在开发的应用程序中大量使用bsCollapse 面板(来自shinyBS 库)。我希望能够在服务器端定义一个面板,如代码所示。代码不运行并返回错误ERROR: argument is of length zero。问题似乎是 bsCollapse 不会接受 renderUI 参数,并且需要在 ui.R 中调用 bsCollapsePanel。
我已经尝试在服务器端使用bsCollapse(),它可以工作但很笨重,因为各个面板不会以相同的方式展开/折叠。我也试过包括outputOptions(output, "hipanel", suspendWhenHidden = FALSE),这个想法是我的“hipanel”会更早地被评估,但这没有用。
我认为关键是 renderUI/uiOutput 没有返回 bsCollapsePanel 接受的对象(至少不是在正确的时间),但我不知道该怎么办。
服务器.R
shinyServer(function(input, output){
output$hipanel<-renderUI({
bsCollapsePanel("hello",helpText("It's working!"))
})
})
ui.R
shinyUI(fluidPage(
mainPanel(
bsCollapse(
bsCollapsePanel("This panel works",helpText("OK")),
uiOutput("hipanel")
))))
【问题讨论】:
标签: shiny