Skip to content

Excel Export in Custom Container #816

@deepanshu88

Description

@deepanshu88

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')))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions