I process tables with over 100,000 rows and use the DT package (development version 0.1.56) to visualize it in a Shiny application.
In addition, I use DT Extensions as: Buttons to load data in various formats. However, although the Scroller extension Scroller also activated, I can only load a few lines (not all data).
Code example:
library("shiny") library("DT") shinyApp( ui = fluidPage(DT::dataTableOutput('tbl')), server = function(input, output) { output$tbl = DT::renderDataTable( iris,extensions=c("Buttons",'Scroller'),options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print'),scrollY = 50, scroller = TRUE )) } )
Also, if I run only this piece of code in R and get datatable in the viewer, I can copy, etc. all lines, how is this possible?
library("DT") datatable( iris, extensions = 'Buttons', options = list( dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print') ) )
I tried different approaches:
Changing scrollY = ... in the options list -> it works, but the scrollY number must be huge in order to actually display all rows of data so that it can be fully loaded - → not a very good approach, since my data comes from the database, I get different number of lines plus this makes the application extremely slow
Using the pageLength parameter: pageLength = ..., lengthMenu=c(..,..,..,..)
However, the selection option is not displayed at all ...
Any ideas how I can solve this problem?
- I know the
downloadHandler() approach , however I would prefer to do it using DT , since the available extensions provide a nice and elegant way that allows you to download data in different formats at the same time, for example, pdf, excel, csv and print.
** I already saw the same question:
Download button loads only 145 rows in DataTables using Scroller
but he did not receive a response in the value of the DT package
Thanks in advance