Below code creates 10 boxes with the ability to close each box and the ids of boxes start with 'box'.
library(shiny)
library(shinydashboardPlus)
box_create <- function(i){
shinydashboardPlus::box(tags$p(paste0("Box",i)),
id = paste0("box", i),
closable = TRUE)
}
all_box <- purrr::map(1:10, ~box_create(.x))
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
all_box
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
I am trying to show an alert to the user when he/she closes all boxes.
I noticed shiny changes the style property whenever we close one box as display = 'none'.
So is it possible to extract all styles associated with the ids which start with 'box' and check if all the style property sets as 'none' using jQuery? If for all ids style="display: none" then an alert would pop up.