Download all rows in the datatable in the single click

In the below application, If I need to download all 32 rows, I will have to go to all pages and then download that is very time consuming. Is there a way to download all rows in the first page it self (Keeping only 10 rows in first sheet)

library(shiny)
library( DT )

# Define UI for application that creates a datatables
ui <- fluidPage(

  # Application title
  titlePanel("Download Datatable")

  # Show a plot of the generated distribution
  , mainPanel(
    DT::dataTableOutput("fancyTable")
  ) # end of main panel

) # end of fluid page

# Define server logic required to create datatable
server <- function(input, output) {

  output$fancyTable <- DT::renderDataTable(
    datatable( data = mtcars
               , extensions = 'Buttons'
               , options = list( 
                 dom = "Blfrtip"
                 , buttons = 
                   list("copy", list(
                     extend = "collection"
                     , buttons = c("csv", "excel", "pdf")
                     , text = "Download"
                   ) ) # end of buttons customization

                 # customize the length menu
                 , lengthMenu = list( c("All") # declare values
                                       # declare titles
                 ) # end of lengthMenu customization
                 , pageLength = 10


               ) # end of options

    ) # end of datatables
  )
} # end of server

# Run the application 
shinyApp(ui = ui, server = server)

I would make place my own downloadButton and provide with download handler involving the full dataframe

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.