【发布时间】:2020-10-08 15:04:05
【问题描述】:
这是对a previous thread 的跟进。答案提供了一个默认显示该框的选项,但是如何将其更改为默认隐藏? 下面的代码混合了两个答案。
library(shiny)
library(shinydashboard)
library(shinyjs)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
useShinyjs()
),
mainPanel(
box(id = "myBox", title = "Tree Output", width = '800px',
selectInput(inputId = "myInput", label = "my input", choices = c(letters))
),
actionButton(inputId = "button", label = "show / hide")
)
)
)
server <- function(input, output){
## observe the button being pressed
observeEvent(input$button, {
shinyjs::toggle("myBox")
})
}
shinyApp(ui, server)
【问题讨论】:
标签: r shiny shinydashboard