R shinyDashbaord通过操作按钮更改箱子状态

R shinyDashbaord通过操作按钮更改箱子状态,r,shinydashboard,status,box,R,Shinydashboard,Status,Box,在shinydashboard中,您可以确定box小部件的状态: 是否可以使用actionbutton将“警告”等状态更改为“信息”?没有太多的经验,我认为这应该是简单的,但提出的解决方案是相当复杂的,没有链接到一个行动按钮。(, 库(闪亮) #具有一行信息框和值框以及两行框的仪表板主体 身体 library(shiny) # A dashboard body with a row of infoBoxes and valueBoxes, and two rows of boxes body

在shinydashboard中,您可以确定box小部件的状态:

是否可以使用actionbutton将“警告”等状态更改为“信息”?没有太多的经验,我认为这应该是简单的,但提出的解决方案是相当复杂的,没有链接到一个行动按钮。(,

库(闪亮)
#具有一行信息框和值框以及两行框的仪表板主体
身体
library(shiny)

# A dashboard body with a row of infoBoxes and valueBoxes, and two rows of boxes
body <- dashboardBody(

    box(title = "Press button to change my status",
        status = "warning", solidHeader = TRUE, collapsible = TRUE,
        sliderInput("test", "test", min=0, max=100, value = 0, step = 10),
        actionButton("testbutton", "change status")
    ), 
  )
)

server <- function(input, output) {
  
# some actionbutton code  
  
}
})
shinyApp(
  ui = dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    body
  ),
  server = server
)
}