我正在尝试在shinydashboard的折叠菜单项中呈现复选框菜单,但我无法让它工作。到目前为止,我在向dashboardBody
呈现时只发现了类似的github issue,但我无法弄清楚它将如何应用于siderbarMenu
。
library('shiny')
library("shinydashboard")
header <- dashboardHeader()
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("Inputs", icon = icon("bar-chart-o"), tabName = "tabOne",
uiOutput('mymenu')
)
)
)
body <- dashboardBody(
h3('nothing here')
)
shinyApp(
ui = dashboardPage(header, sidebar, body),
server = function(input, output) {
output$mymenu <- renderUI({
checkboxGroupInput('mymenu', 'lettersMenu',
letters[1:5],
letters[1:5])
})
}
)
答案 0 :(得分:0)
我认为问题在于没有触发此renderUI
的内容。尝试将其添加到您的代码中:
outputOptions(output, "mymenu", suspendWhenHidden = FALSE)
library('shiny')
library("shinydashboard")
header <- dashboardHeader()
sidebar <- dashboardSidebar(
sidebarMenu(
menuItem("Inputs", icon = icon("bar-chart-o"), tabName = "tabOne",
uiOutput('mymenu')
)
)
)
body <- dashboardBody(
h3('nothing here')
)
shinyApp(
ui = dashboardPage(header, sidebar, body),
server = function(input, output) {
output$mymenu <- renderUI({
checkboxGroupInput('mymenu', 'lettersMenu',
letters[1:5],
letters[1:5])
})
outputOptions(output, "mymenu", suspendWhenHidden = FALSE)
}
)