Coder Social home page Coder Social logo

Comments (4)

phillc73 avatar phillc73 commented on May 19, 2024 1

I had a look at your code and think I've found a fix. Basically, move the box() into dashboardBody(), and just have the content of the box in output$ui.

Here's some code, with an extra box() added just for fun:

library("shinydashboard")

body <- dashboardBody(
    box(title = "Collapse Me",
        width = 6,
        status = "warning", 
        solidHeader = TRUE, 
        collapsible = TRUE,
        uiOutput("ui")
        ),
    box(title = "Collapse Me Too!", 
        width = 6,
        status = "success", 
        solidHeader = TRUE, 
        collapsible = TRUE,
        uiOutput("uiToo")
        )
  )

server <- function(input, output) {

  output$ui <- renderUI({
    paste("Click to see the box collapse")
    })

  output$uiToo <- renderUI({
    paste("Click to see another box collapse")
    })
}

shinyApp(
  ui = dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    body
  ),
  server = server
)

I hope that helps.

As an aside, if you use the "height" attribute within the box(), just the content within the box collapses and not the box() itself, which is somewhat interesting.

from shinydashboard.

wch avatar wch commented on May 19, 2024

I think the root of the problem is that the Javascript code expects that the various components only need to be initialized when the page is loaded. I'll see what can be done.

from shinydashboard.

wch avatar wch commented on May 19, 2024

I've pushed a fix. I'll also try to get it in the upstream AdminLTE sources.

from shinydashboard.

happyshows avatar happyshows commented on May 19, 2024

@wch
Hi Wiston, is there a way to call the show/hide events from a button?
I am using loops to dynamically generate a couple boxes. I want the user to be able to click a button to expand all / collapse all at their preference. Is there some syntax like updateBox(collapse=FALSE/TRUE)?

from shinydashboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.