tzema
tzema

Reputation: 461

Use filters and buttons with dtedit in R shiny

I am trying to use the Dtedit library in R- shiny (I am veeery new to this). I have tried to find some way to use filters with the dtedit function (like 'filter="top"' in DT::datatable), but with no success.. Also, I am getting the following errors when I try to use the "Datatables options - buttons" code, to add copy, CSV, PDF and Excel buttons:

    Warning: Error in dtedit: unused argument (datatable.call = function(...) {
DT::datatable(..., extensions = "Buttons")
})
50: server [#3]
Error in dtedit(input, output, name = "Grocery_List", thedata = data.frame(Buy = c("Tea", :
unused argument (datatable.call = function(...) {
DT::datatable(..., extensions = "Buttons")
})

I am using the most recent versions of the dtedit and shiny packages.

Any help matters! Many thanks for your time!

Upvotes: 1

Views: 499

Answers (1)

tzema
tzema

Reputation: 461

Well, there seems to be a release version of DTedit that allows for all these functionalities (filters and export buttons).

I installed it like this:

devtools::install_github('DavidPatShuiFong/[email protected]')

You may see the relevant github page, with lots of examples, here:https://github.com/DavidPatShuiFong/DTedit

Now also the example shiny apps in the relevant RPubs vignette are working.

To allow for both filters and buttons, I simply add this argument inside dtedit() of server:

datatable.call = function(...)
         {DT::datatable(..., extensions = 'Buttons', filter="top")},
         datatable.options = list(
           dom = 'Bfrtip',
           buttons = c('copy', 'csv', 'pdf', 'excel')
)

Hope it can be helpful!

Upvotes: 2

Related Questions