rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
886 stars 300 forks source link

uiOutput versus menuItem selected = TRUE #350

Open tonihaag opened 3 years ago

tonihaag commented 3 years ago

Hello, I'm trying to dynamically change which menuItem is selected - in the earlier months of the year, I want to show a tab which contains information about "last year," but as the year progresses, "last year" stats become less important.

However, I've found this question in StackOverflow which mentioned a possible issue between uiOutput versus menuItem selected = TRUE: https://stackoverflow.com/questions/52706116/shinydashboard-menusubitem-not-rendering-at-start-in-case-of-several-menusubite

I can't switch to not using uiOutput because I have some fancy filters that I'd like applied...

I figured this wasn't the intended action, so I'm mentioning the issue!

ismirsehregal commented 3 years ago

This seems to be a duplicate of https://github.com/rstudio/shinydashboard/issues/335 and https://github.com/rstudio/shinydashboard/issues/319 - renaming the output (something other than "body") helps.

tonihaag commented 3 years ago

My output isn't named "body" ... plus as mentioned in the StackOverflow post I received in response to this GitHub post, it doesn't work when you have reactive datasets

I can't post my entire code online because it's for a company and there's privacy and all that jazz, but here's my snippet from the body:

ui <- function(request) {
  dashboardPagePlus(

    ## formatting ##
    skin = "black",
    collapse_sidebar = FALSE,

    ## objects ##
    header = ui_header,
    sidebar = ui_sidebar,
    body = dashboardBody(
      tabItems(
        bodyDrilldown('bodyDrilldown'),
        bodyBenchmark('bodyBenchmark'),
        bodyHelp('bodyHelp')
      ),
      ## CSS styling ##
      tags$head(tags$style(styling))
    )

  )
}
ismirsehregal commented 3 years ago

Can you please provide a reproducible example with some dummy data?

sanjmeh commented 1 year ago

My output isn't named "body" ... plus as mentioned in the StackOverflow post I received in response to this GitHub post, it doesn't work when you have reactive datasets

I can't post my entire code online because it's for a company and there's privacy and all that jazz, but here's my snippet from the body:

ui <- function(request) {
  dashboardPagePlus(

    ## formatting ##
    skin = "black",
    collapse_sidebar = FALSE,

    ## objects ##
    header = ui_header,
    sidebar = ui_sidebar,
    body = dashboardBody(
      tabItems(
        bodyDrilldown('bodyDrilldown'),
        bodyBenchmark('bodyBenchmark'),
        bodyHelp('bodyHelp')
      ),
      ## CSS styling ##
      tags$head(tags$style(styling))
    )

  )
}

Have you proceeded on this issue elsewhere? Can you kindly close the issue if solved, and how did you solve it? Thanks.