I have create a Shiny App where I can download my table in various file formats (pdf, excel, csv). However, I have found that each of them has the same title that my Shiny App has ("This is my table in Shiny").
I use this extension from DataTable.
Does anyone know if I can delete that title from the downloaded files?
These are the downloaded files (excel and pdf)
My code:
library(shiny)
library(DT)
ui <- fluidPage(
# Application title
titlePanel("This is my table in Shiny")
, mainPanel(
DT::dataTableOutput("fancyTable")
)
)
server <- function(input, output) {
output$fancyTable <- DT::renderDataTable(
datatable( data = mtcars
, extensions = 'Buttons'
, options = list(
dom = "Blfrtip"
, buttons =
list("copy", list(
extend = "collection"
, buttons = c("csv", "excel", "pdf")
, text = "Download"
) )
, lengthMenu = list( c(10, 20, -1)
, c(10, 20, "All")
)
, pageLength = 10
)
)
)
}
# Run the application
shinyApp(ui = ui, server = server)
Thanks in advance
Regards
Trying a lot of things and searching another posts... I found the solution!
I needed to put each option into a list to be able to add the "title" parameter for each one.
library(shiny)
library(DT)
ui <- fluidPage(
# Application title
titlePanel("This is my table in Shiny")
, mainPanel(
DT::dataTableOutput("fancyTable")
)
)
server <- function(input, output) {
output$fancyTable <- DT::renderDataTable(
datatable( data = mtcars
, extensions = 'Buttons'
, options = list(
dom = "Blfrtip",
buttons =
list("copy", list(
extend = "collection",
buttons = list(
list(extend = "csv", title = "MY TITLE"),
list(extend = "excel", title = "MY TITLE"),
list(extend = "pdf", title = "MY TITLE")),
text = "Download"
)),
lengthMenu = list( c(10, 20, -1)
, c(10, 20, "All")
),
pageLength = 10
)
)
)
}
# Run the application
shinyApp(ui = ui, server = server)
Here you can see the new title!