rstudio / shinydashboard

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

shiny or DT dataTables don't work with shinydashboard #223

Closed DaveMacaron closed 7 years ago

DaveMacaron commented 7 years ago

My first bug. I enjoy working with shinydashboard but it's frustrating when datatable output is blank for all examples. The file upload or any datatable doesn't work as soon as you wrap it in the shinydashboard framework. I hope you can help. I have a new project I want to show my boss. THANKS!

library(shinydashboard)

header <- dashboardHeader() sidebar <- dashboardSidebar()

body <- dashboardBody(

dataTableOutput WORKS BY ITSELF UNTIL YOU WRAP IT IN dashboardPage

mainPanel( tabsetPanel( id ='dataset', tabPanel('Display length', DT::dataTableOutput('ex1')), tabPanel('Length menu', DT::dataTableOutput('ex2')), tabPanel('No pagination', DT::dataTableOutput('ex3')), tabPanel('No filtering', DT::dataTableOutput('ex4')), tabPanel('Function callback', DT::dataTableOutput('ex5')) ))

##############################################################

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

bborgesr commented 7 years ago

What exactly do you mean by "doesn't work"? I can't reproduce any issue:

library(shiny)
library(shinydashboard)
library(DT)

shinyApp(
  ui = dashboardPage(
    dashboardHeader(), 
    dashboardSidebar(), 
    dashboardBody(DT::dataTableOutput('dt'))
  ),
  server = function(input, output, session) { 
    output$dt <- DT::renderDataTable(head(mtcars))
  }
)

Your problem may have been the lack of the session argument in the server function (after input and output) if you use a function that depends on it in some way. Though I'd be suspicious of that without a clear error message...

I'll close this issue for now. If you have a reproducible example of a problem, let me know and I'll re-open.