-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function call to close boxPlus #10
Comments
It would be amazing too to provide some server logic to close button, just to do the opposite: once user has clicked close button on a boxPlus, perform an action on the server side. Thanks! |
@samuelhuerga: Hi! Can you provide an example please? What kind to action do you want to see? |
@samuelhuerga @DivadNojnarg Example:
Is this possible? |
WIP in v 0.8.0.9000 (github): For now the box can only be programmatically collapsed but the remove action is also possible (not yet available) library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
ui <- dashboardPagePlus(
dashboardHeaderPlus(),
dashboardSidebar(),
dashboardBody(
tags$style("body { background-color: ghostwhite};"),
br(),
boxPlus(
title = textOutput("box_state"),
"Box body",
inputId = "mybox",
collapsible = TRUE,
plotOutput("plot")
),
actionButton("toggle_box", "Toggle Box", class = "bg-success")
)
)
server <- function(input, output, session) {
output$plot <- renderPlot({
req(!input$mybox$collapsed)
plot(rnorm(200))
})
output$box_state <- renderText({
state <- if (input$mybox$collapsed) "collapsed" else "uncollapsed"
paste("My box is", state)
})
observeEvent(input$toggle_box, {
updateBoxPlus("mybox")
})
}
shinyApp(ui, server) |
Use case:
use modules together with the boxPlus, each box represents certain data element and there's an action button to delete the element (box) in database. Will need a programatic interface to close the box once the data element is deleted.
The text was updated successfully, but these errors were encountered: