rstudio / shinydashboard

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

Dashboard Layout issue on running a shinyapp function from within ShinyDashboard #116

Open debsush opened 8 years ago

debsush commented 8 years ago

Hi,

I am facing some issues with ShinyDashboard layout. I have a shinyapp converted into a function called Func101(). I intend to run this app on choosing a given sidebar menu in shiny dashboard. While I am able to see the shinyapp Func101() displayed within the main body of the shinydashboard on selecting the given sidebar menu, however, the layout has issues in the sense the Func101() ui is allotted only 1/4th of the total main body height along with a vertical scroll bar. I would like the Func101() ui to cover the entire main body without any vertical scroll bars just as though I am writing the ui.R (of the Func101() function) code within the ShinyDashboard body.

How do I achieve such a user interface

Example:

header<-dashboardHeader(title = "Example") sidebar<-dashboardSidebar( sidebarMenu( menuItem("Analysis101", tabName = "A101", icon = icon("dashboard")), menuItem("About us", icon = icon("th"), tabName = "bio") ) ) ui<-dashboardPage( header, sidebar, dashboardBody( tabItems( tabItem(tabName = "A101", Func101(1)), tabItem(tabName = "bio", h2("technical tab content")) ) ) )

server <- function(input, output, session) { } shinyApp(ui, server) I have attached the screenshot for your review. How do I fix the scrollbar on the right and the height of the diplay ? Regards, SD

image ShinyDashboard Layout Issue.docx

debsush commented 8 years ago

Here is a more reproducible code that will help you understand the issue

ui.R

library(data.table) library(shinyapps) library(rsconnect) library(shinyjs) library(shiny) library(shinyBS) library(htmltools) library(DT) library(shinydashboard)

binner <- function(var) { require(shiny) shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel(sliderInput("n", "Bins", 5, 100, 20)), mainPanel(plotOutput("hist"), br(), br(), hr(), plotOutput("hist1")) ) ), server = function(input, output) { output$hist <- renderPlot( hist(var, breaks = input$n, col = "skyblue", border = "white") )

  output$hist1 <- renderPlot( 
    hist(var, breaks = input$n,
         col = "skyblue", border = "white") 
  )
}

) }

header<-dashboardHeader(title = "Example")

sidebar<-dashboardSidebar( sidebarMenu( menuItem("Analaysis 101", tabName = "A101", icon = icon("dashboard")), menuItem("About Us", tabName = "bio", icon = icon("dashboard")), id = "sbMenu" ) )

################################################UI########################################################### ui<-dashboardPage(

header,

sidebar,

dashboardBody(

useShinyjs(),

tabItems(
  tabItem(tabName = "A101",binner(faithful$eruptions)),
  tabItem(tabName = "bio",h2("bio tab content"))
)

)
)

server.R

shinyServer(function(input, output, session) {

})

Please let me know in case of any queries

Regards,