rstudio / flexdashboard

Easy interactive dashboards for R
https://pkgs.rstudio.com/flexdashboard/
Other
816 stars 301 forks source link

corrupting DT:renderDataTable functions #28

Closed missymorrow closed 8 years ago

missymorrow commented 8 years ago

Before installing the flexdashboardpackage I was able to execuate this example from the DT library documentation just fine without any issues,

library(shiny)
shinyApp(
  ui = fluidPage(DT::dataTableOutput('tbl')),
  server = function(input, output) {
    output$tbl = DT::renderDataTable(
      iris, options = list(lengthChange = FALSE)
    )
  }
)

After installing the flexdashboardpackage when i run the same code above the output from the renderDataTable function is corrupted. The datatable does not render accurately and all I see is one line with column names as shown below and I am unable to see the actual contents of the datatable.

test1

Also renderDataTable does not work while producing Flexdashboard apps using RMarkdown.

harryprince commented 8 years ago

you need to use formattable::as.htmlwidget() function to convert dataTable results into html

missymorrow commented 8 years ago

I am confused with this answer because I did not use formattable::as.htmlwidget() in shiny before and renderDataTable was working fine without having to add this function also the documentation on DT does not recommend using formattable::as.htmlwidget() so are you suggesting that I use formattable::as.htmlwidget() in Rmarkdown while using renderDataTable

jjallaire commented 8 years ago

We set a couple of DT options to make it behave properly within flexdashboard and these need to be unset after using flexdashboard (we'll take care of the unset in a future version of flexdashboard but don't yet have the hooks to do this cleanly from rmarkdown). Try executing this code at the top of your Shiny server.R:

options(DT.fillContainer = FALSE) options(DT.autoHideNavigation = FALSE)

On Mon, May 23, 2016 at 1:04 AM, HarryZhu notifications@github.com wrote:

you need to use as.html function to convert dataTable results into html

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/rstudio/flexdashboard/issues/28#issuecomment-220888052

missymorrow commented 8 years ago

@jjallaire after adding those two lines everything is working fine another issue is that renderdatatabledoes not render the datatable while I am trying some flexdashboard type apps using Rmarkdown.

jjallaire commented 8 years ago

fixsed via https://github.com/rstudio/flexdashboard/commit/854a2ceb867522fa892d66417a43733e476c92ec