Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel Export in Custom Container #816

Open
deepanshu88 opened this issue Jun 7, 2020 · 1 comment
Open

Excel Export in Custom Container #816

deepanshu88 opened this issue Jun 7, 2020 · 1 comment

Comments

@deepanshu88
Copy link

When Custom Table Container is there, it does not export in excel the way it is showing in actual DT table. For example : Sepal and Petal columns are not showing in exported file.

sketch = htmltools::withTags(table(
  class = 'display',
  thead(
    tr(
      th(class = 'dt-center', rowspan = 2, style = "border-right: solid 1px #aaaaaa;", 'Species'),
      th(class = 'dt-center', colspan = 2, style = "border-right: solid 1px #aaaaaa;", 'Sepal'),
      th(class = 'dt-center', colspan = 2, 'Petal'),
    ),
    tr(
      th("Length"),
      th(style = "border-right: solid 1px #aaaaaa;", "Width"),
      th("Length"),
      th("Width")
    )
  )
))


datatable(iris[1:20, c(5, 1:4)], container = sketch, extensions = 'Buttons', rownames = FALSE,
          options = list(paging = FALSE, searching = FALSE, ordering=F, info = FALSE,
                         columnDefs = list(list(className = 'dt-center', targets = 0:4)),
                         dom = 'Bfrtip',
                         buttons = 
                           list(list(
                             extend = 'collection',
                             text = '<i class="fa fa-bars"></i>',
                             autoClose =  TRUE,
                             buttons = list('csv', 'excel')))))

@mtyszler
Copy link

mtyszler commented Jun 7, 2020

Hi @deepanshu88 . This is actually a "known" problem. See my PR #751 and the upstream PR DataTables/Buttons#170.

Feel free to install my fork
remotes::install_github('mtyszler/DT', ref = "feature/complex_headers")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants