Code Monkey home page Code Monkey logo

Comments (5)

name-name avatar name-name commented on August 22, 2024

Just ran into the same problem and had to revert to version 0.3.1 because of this :-(
(Well, or start the boxes as collapsed=FALSE)

from shinydashboard.

jcheng5 avatar jcheng5 commented on August 22, 2024

This sounds like maybe just a shown or hidden event needs to be triggered?

from shinydashboard.

wch avatar wch commented on August 22, 2024

Yup, it just needed those events to be triggered.

For future reference, here's a streamlined test app:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Inputs", icon = icon("bar-chart-o"), tabName = "tabOne"
      )
    )
  ),
  dashboardBody(
    tabItems(
      tabItem("tabOne",
        box(title = "Test Box One", 
          status = "success", 
          solidHeader = TRUE, 
          collapsible = TRUE,
          collapsed = TRUE,
          plotOutput("plot", height = 250),
          verbatimTextOutput("boxOneText")
        ),
        box(
          actionButton("go", "Go")
        )
      )
    )
  )
)

server <-  function(input, output) {
  output$plot <- renderPlot({
    cat(paste("plotting", input$go, "\n"))
    plot(rnorm(1 + input$go), rnorm(1 + input$go))
  })
  output$boxOneText <- renderText({
    paste("Go counter:", input$go)
  })
}

shinyApp(ui, server)

from shinydashboard.

happyshows avatar happyshows commented on August 22, 2024

@wch
Currently, I am wrapping a DT table inside a box. If a user click a cell, it will trigger an cell_clicked observe event to do certain operation. Now I want to put a line to 'collapse the box' at the end of observe event.
However, if I setup a session variable and use it to trigger a redraw of the box, the dt table will disappear. (I guess shiny does not allow an object to be defined twice??)

Is there any function to update the status of collapse? something like updateTabsetPanel? I'm open to alternatives too.

server.R
sess$boxFlag <- FALSE

observeEvent(input$dt_summary_cell_clicked,{
isolate({
if(length(cellValue <-input$dt_summary_cell_clicked) == 0) return(invisible())
sess$boxFlag <- TRUE
})
})

ui.R
output$ui_box <- renderUI({
flag <- sess$boxFlag

isolate({
box(title = 'Summary', width = 12, status = 'primary', collapsible = TRUE, collapsed = flag,
dataTableOutput('dt_summary')
)
})
})

Let me know if more clarification is required.

from shinydashboard.

DarioBoh avatar DarioBoh commented on August 22, 2024

I have the same problem but when rendering on sidebarMenu, am I doing anything wrong?


library('shiny')
library("shinydashboard")

header <- dashboardHeader()

sidebar <- dashboardSidebar(
  sidebarMenu(
    menuItem("Inputs", icon = icon("bar-chart-o"), tabName = "tabOne",
             uiOutput('mymenu')
    )
  )
)

body <- dashboardBody(
  h3('nothing here')
)

shinyApp(
  ui = dashboardPage(header, sidebar, body),
  server = function(input, output) {


    output$mymenu <- renderUI({

      checkboxGroupInput('mymenu', 'lettersMenu',
                         letters[1:5],
                         letters[1:5])
    })
  }
)

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.