我开发了一个闪亮的应用程序,我们在用户界面中使用各种框对象。目前,箱子通过单击框标题右侧的“+/-”符号进行展开/折叠,但是我们需要在单击标题(框标题的任何位置)时展开/折叠。
以下是示例代码:
如果您查看具有图表的框,请让扩展和折叠在单击标题即“直方图框标题”上执行,而不仅仅是在标题右侧的“+/-”符号上执行:
## Only run this example in interactive R sessions
if (interactive()) {
library(shiny)
# A dashboard body with a row of infoBoxes and valueBoxes, and two rows of boxes
body <- dashboardBody(
# Boxes
fluidRow(
box(title = "Histogram box title",
status = "warning", solidHeader = TRUE, collapsible = TRUE,
plotOutput("plot", height = 250)
)
)
)
server <- function(input, output) {
output$plot <- renderPlot({
hist(rnorm(50))
})
}
shinyApp(
ui = dashboardPage(
dashboardHeader(),
dashboardSidebar(),
body
),
server = server
)
}