Shiny b renderUI中的CollapsePanel
我在我正在开发的应用程序中大量使用Shiny b renderUI中的CollapsePanel,shiny,Shiny,我在我正在开发的应用程序中大量使用bsCollapse面板(来自shinyBS库)。我希望能够在服务器端定义一个面板,如代码所示。代码不运行并返回一个错误错误:参数的长度为零。问题似乎是bsCollapse不接受renderUI参数,并且需要在ui.R中调用bsCollapsePanel 我试过在服务器端安装bsCollapse(),它可以工作,但很笨重,因为单个面板不会以相同的方式展开/折叠。我还尝试了包含输出选项(输出,“hipanel”,suspendWhenHidden=FALSE),其
bsCollapse
面板(来自shinyBS
库)。我希望能够在服务器端定义一个面板,如代码所示。代码不运行并返回一个错误错误:参数的长度为零
。问题似乎是bsCollapse
不接受renderUI
参数,并且需要在ui.R中调用bsCollapsePanel
我试过在服务器端安装bsCollapse()
,它可以工作,但很笨重,因为单个面板不会以相同的方式展开/折叠。我还尝试了包含输出选项(输出,“hipanel”,suspendWhenHidden=FALSE)
,其想法是我的“hipanel”将在更早的时候进行评估,但这不起作用
我认为关键在于renderUI/uiOutput没有返回一个被bsCollapsePanel
接受的对象(至少不是在正确的时间),但我不确定该怎么办
服务器.R
shinyServer(function(input, output){
output$hipanel<-renderUI({
bsCollapsePanel("hello",helpText("It's working!"))
})
})
似乎
bsCollapse
需要一个bsCollapsePanel
,因此只需将此添加到中,然后您就可以在内容中添加任何您想要的内容:
library(shiny)
library(shinyBS)
ui <- shinyUI(fluidPage(
mainPanel(
bsCollapse(
bsCollapsePanel("This panel works",helpText("OK")),
bsCollapsePanel("hello",uiOutput("hipanel"))
)
)))
server <- shinyServer(function(input, output,session){
output$hipanel<- renderUI({
helpText("It's working!")
})
})
shinyApp(ui,server)
库(闪亮)
图书馆(shinyBS)
ui似乎bsCollapse
需要一个bsCollapsePanel
,因此只需将此添加到中,然后您就可以在内容中添加任何您想要的内容:
library(shiny)
library(shinyBS)
ui <- shinyUI(fluidPage(
mainPanel(
bsCollapse(
bsCollapsePanel("This panel works",helpText("OK")),
bsCollapsePanel("hello",uiOutput("hipanel"))
)
)))
server <- shinyServer(function(input, output,session){
output$hipanel<- renderUI({
helpText("It's working!")
})
})
shinyApp(ui,server)
库(闪亮)
图书馆(shinyBS)
ui感谢您的回复,但我特别希望服务器端有bsCollapsePanel
,ui中有bsCollapse
。我需要动态生成一些面板,我不想求助于将整个UI放在renderUI中(我的大部分UI是可折叠的)。感谢您的响应,但我特别希望服务器端有bsCollapsePanel
,UI中有bsCollapse
。我需要动态生成一些面板,我不想求助于将整个UI放在renderUI中(我的大部分UI是可折叠的)。
library(shiny)
library(shinyBS)
ui <- shinyUI(fluidPage(
mainPanel(
uiOutput("hipanel")
)))
server <- shinyServer(function(input, output,session){
output$hipanel<- renderUI({
bsCollapse(
bsCollapsePanel("This panel works",helpText("OK")),
bsCollapsePanel("hello",helpText("It's working!"))
)
})
})
shinyApp(ui,server)