RinteRface / shinydashboardPlus

extensions for shinydashboard
https://shinydashboardplus.rinterface.com
Other
454 stars 77 forks source link

boxPlus() clashes with enable_preloader #51

Closed leungi closed 4 years ago

leungi commented 5 years ago

Reproducible code below.

Expected: regardless of value of sidebar_start_open argument in boxPlus(), nothing shows up on loading screen when enable_preloader = TRUE.

Outcome: sidebar_start_open must be FALSE when enable_preloader = TRUE to get above expected result.

## example with boxPlus sidebar showing up on load
library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(leaflet)

map <- leaflet() %>% addTiles()

shinyApp(
  ui = dashboardPagePlus(
    enable_preloader = TRUE,
    dashboardHeaderPlus(),
    dashboardSidebar(),
    dashboardBody(
      setShadow("box"),
      fluidRow(
        boxPlus(
          title = "Closable Box with dropdown", 
          closable = TRUE, 
          status = "warning", 
          solidHeader = FALSE, 
          collapsible = TRUE,
          enable_sidebar = TRUE,
          sidebar_width = 25,
          sidebar_start_open = TRUE,
          sidebar_content = tagList(
            checkboxInput("somevalue", "Some value", FALSE),
            verbatimTextOutput("value")
          ),
          map
        )
      )
    )
  ),
  server = function(input, output) {
    output$value <- renderText({ input$somevalue })
  }
)
## example with boxPlus sidebar hidden on load
library(shiny)
library(shinydashboard)
library(shinyWidgets)
library(leaflet)

map <- leaflet() %>% addTiles()

shinyApp(
  ui = dashboardPagePlus(
    enable_preloader = TRUE,
    dashboardHeaderPlus(),
    dashboardSidebar(),
    dashboardBody(
      setShadow("box"),
      fluidRow(
        boxPlus(
          title = "Closable Box with dropdown", 
          closable = TRUE, 
          status = "warning", 
          solidHeader = FALSE, 
          collapsible = TRUE,
          enable_sidebar = TRUE,
          sidebar_width = 25,
          sidebar_start_open = FALSE,
          sidebar_content = tagList(
            checkboxInput("somevalue", "Some value", FALSE),
            verbatimTextOutput("value")
          ),
          map
        )
      )
    )
  ),
  server = function(input, output) {
    output$value <- renderText({ input$somevalue })
  }
)
DivadNojnarg commented 4 years ago

Do you still have the issue. I don't manage to reproduce it

leungi commented 4 years ago

Attached is screencast showing the behaviour when sidebar_start_open = TRUE - the box shows up while loader splash screen is active on app start up.

dashboardPlus_issue

leungi commented 4 years ago

Thanks for the update 🙏