Buttons: download button with scroller downloads only few rows
Clash Royale CLAN TAG#URR8PPP
Buttons: download button with scroller downloads only few rows
I am handling tables with more than 100 000 rows and using DT
package (development version 0.1.56) to visualize it in Shiny App.
DT
Furthermore I am using DT
Extensions as: Buttons
, to download the data in different formats. However while Scroller
extension is as well activated, i am able only to download few rows (not all data).
DT
Buttons
Scroller
Sample code:
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
))
)
Additionally if i run only this part of the code in R and get the datatable in the viewer, i am able to copy etc. all rows, how it is even possible?
library("DT")
datatable(
iris,
extensions = 'Buttons', options = list(
dom = 'Bfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')
)
)
I have tried different approaches:
Changing scrollY =
... in the option list -> it is working but the number of scrollY
has to be huge to actually display all data rows so it could be downloaded fully --> not good approach, as my data comes from Database, i obtain different number of rows plus it makes the app extremally slow
scrollY =
scrollY
Using pageLength option: pageLength = ..., lengthMenu=c(..,..,..,..)
pageLength = ..., lengthMenu=c(..,..,..,..)
However the option to choose is not displayed at all...
Any ideas how i can solve this problem?
downloadHandler()
DT
**I have seen already the same question:
Download button downloads only 145 rows in DataTables with Scroller
but it has not been answered in the meaning of DT
package
DT
Thanks in advance
server=FALSE
DT::renderDataTable
Hi Carl, actually that is working perfectly! Thanks! If You post it as an answer i am going to accept it straight away
– Mal_a
Jul 25 '16 at 5:18
2 Answers
2
The issue is that when server=TRUE
only the data being displayed is being sent to the client. Setting server=FALSE
renders all the DT stuff in the client so all the data is there.
server=TRUE
server=FALSE
It is indeed server = TRUE
that does the trick.
server = TRUE
Here is the code since some people like me might put the argument in the wrong place.
library("shiny")
library("DT")
shinyApp(
ui = fluidPage(DT::dataTableOutput('tbl')),
server = function(input, output)
output$tbl = DT::renderDataTable(server = FALSE,
DT::datatable(iris,
extensions=c("Buttons",'Scroller'),
options = list(dom = 'Bfrtip',
buttons = c('copy', 'csv',
'excel', 'pdf',
'print'),
scrollY = 50,
scroller = TRUE)
)
)
)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
What happens if you add
server=FALSE
inDT::renderDataTable
?– Carl
Jul 22 '16 at 22:08