R shiny buttons export formated columns

R shiny buttons export formated columns

vovo4kavovo4ka Posts: 2Questions: 1Answers: 0

The extensions 'Buttons' works great for shiny application. However it export the data without formatting. Is there a way to export data with format (e.g. percentage, or currency)?

Reproducible code

library(DT)

data.frame(a = c(1,2),
b = c(2,3)) %>%
datatable(extensions = 'Buttons', options = list(
dom = 'Bfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')) )%>%
formatPercentage('a') %>%
formatCurrency('b')

Answers

  • allanallan Posts: 61,971Questions: 1Answers: 10,160 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

  • kthorngrenkthorngren Posts: 20,423Questions: 26Answers: 4,794

    You can find examples of how to format the export output here:
    https://datatables.net/extensions/buttons/examples/

    Kevin

  • vovo4kavovo4ka Posts: 2Questions: 1Answers: 0
    edited February 2017

    Thank @kthorngren , yes the export work in the example, however I'm having problems applying it in the shiny application.

  • allanallan Posts: 61,971Questions: 1Answers: 10,160 Site admin

    As I mentioned, we'd need a test case. If it works in the example on this site, the issue is most likely an integration one. Hence the need for a test case :smile: .

    Allan

This discussion has been closed.