2

Trying to make use of the DT package within a R/Shiny app, and running into a bit of an issue.

I'd like to make use of the ellipsis plugin, as well as a custom button to download all the data (DT default is to just download the current page shown).

See code below:

library(DT)
datatable(iris,
          rownames = F,
          extensions = "Buttons",
          plugins = "ellipsis",
          selection = 'none',
          options = list( dom = 'Bfrtip',
                         searching = F,
                         processing = F,
                         pageLenth = 20,
                         buttons = list(
                           list(extend = "csv", text = "Download Full Results", filename = "Full_data",
                                exportOptions = list(
                                  modifier = list(page = "all")
                                )
                           )
                         ),
                         columnDefs = list(list(
                           targets = c(4),
                           render = JS("$.fn.dataTable.render.ellipsis( 5 )")
                         )))

)

This displays fine, but when you press the 'Download Full Results" button and open in Excel, the ellipsis are rendered to weird/unfamilar characters ( … ). Ideally, I'd like the download button to ignore the ellipses. Any ideas?

Kyle Weise
  • 23
  • 2

1 Answers1

3

This works if you add the option orthogonal = "export" to exportOptions:

buttons = list(
  list(extend = "csv", text = "Download Full Results", filename = "Full_data",
       exportOptions = list(
         modifier = list(page = "all"),
         orthogonal = "export"
       )
  )
)
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225