rstudio / shinydashboard

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

insertUI is not working on bringing shinydashboard elements as a whole #277

Closed berkorbay closed 4 years ago

berkorbay commented 6 years ago

Hi there. I try to put a prior screen before the dashboard and after the click on a button or similar action I would like to bring the main UI containing the dashboard. I manage to do it in ordinary Shiny elements but not dashboard elements. Here is a reproducible example.

library(shiny)
library(shinydashboard)

sserver <- shinyServer(function(input, output, session){

    observeEvent(input$test1,{

        removeUI(selector="#test1")
        insertUI(selector="body",where="beforeEnd",
        ui=the_ui,
        immediate = TRUE)

        print("Working")

    })

})

the_ui <-
dashboardPage(
  dashboardHeader(title="The Title",disable = FALSE),
  dashboardSidebar(
      sidebarMenu(id="tabs",
          ##Tab One
          menuItem("Main Page",tabName = "main",icon = icon("home"))
      )
  ),
  dashboardBody(
      tabItems()
  )
)

initial_ui <-
    fluidPage(
        actionButton(inputId="test1",label="Hebele")
    )

shinyApp(ui=initial_ui,server=sserver)
rrcardoso commented 4 years ago

Hello friend, have you found the solution?

berkorbay commented 4 years ago

Hello friend, have you found the solution?

We managed past it somehow :)