Remi
Remi

Reputation: 1111

R Shiny: download the whole dataset with DT::renderDataTable

I am using DT::renderDataTable and DT::datatable with extension 'Buttons' to allow user to download a table in R Shiny app.

With this script, the user can download data he sees on his screen (eg: User uses the selector to show 1 to 25 of 50 entries and clicks on donwload button: only the 1 to 25 rows will be downloaded)

Is there a way to modify the button behviours to allow user to download the whole dataset (50 rows)?

Thanks for your help!

Here is my current script:

output$mytable2  <- DT::renderDataTable(
                            DT::datatable(
                                { plots.dfs()[[2]] },

                                extensions = 'Buttons',

                                options = list(                                                     
                                    fixedColumns = TRUE,
                                    autoWidth = TRUE,
                                    ordering = TRUE,
                                    dom = 'Bliftsp',
                                    buttons = c('copy', 'csv', 'excel')
                                ),


                                class = "display"
                           ))

Upvotes: 2

Views: 1826

Answers (1)

Aur&#232;le
Aur&#232;le

Reputation: 12819

Use the server = FALSE argument to renderDataTable.

ref : rstudio.github.io/DT/server.html

Upvotes: 4

Related Questions