DT::datatable 使用闪亮应用程序的标题导出选项
Title export options of DT::datatable using shiny app
鉴于以下闪亮的应用程序:
library(shiny)
library(tidyverse)
library(DT)
ui <- fluidPage(
br(),
DTOutput("DT")
)
server <- function(input, output) {
output$DT <- renderDataTable({
mtcars %>%
datatable(.,extensions = 'Buttons',
options = list(dom = 'Bfrtip',
exportOptions = list(header = ""),
buttons = c('copy', 'csv', 'excel', 'pdf')))
})
}
shinyApp(ui = ui, server = server)
可以使用数据table 左上角的按钮在剪贴板中复制完整的table。
但是当将内容粘贴到 excel、记事本或任何有 header 的内容时,我想将其删除。
我很确定 header 可以删除或更改。类似于 exportOptions = list(header = ""),
。但毫不奇怪,这是行不通的。或许可以找到或翻译从 here 到 R/Shiny 的解决方案。
这是按钮的 title
选项:
library(shiny)
library(DT)
ui <- fluidPage(
br(),
DTOutput("DT")
)
server <- function(input, output) {
output$DT <- renderDT({
mtcars %>%
datatable(., extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
buttons = list(
list(
extend = "copy",
text = "COPY",
title = NULL
)
)
)
)
})
}
shinyApp(ui = ui, server = server)
鉴于以下闪亮的应用程序:
library(shiny)
library(tidyverse)
library(DT)
ui <- fluidPage(
br(),
DTOutput("DT")
)
server <- function(input, output) {
output$DT <- renderDataTable({
mtcars %>%
datatable(.,extensions = 'Buttons',
options = list(dom = 'Bfrtip',
exportOptions = list(header = ""),
buttons = c('copy', 'csv', 'excel', 'pdf')))
})
}
shinyApp(ui = ui, server = server)
可以使用数据table 左上角的按钮在剪贴板中复制完整的table。
但是当将内容粘贴到 excel、记事本或任何有 header 的内容时,我想将其删除。
我很确定 header 可以删除或更改。类似于 exportOptions = list(header = ""),
。但毫不奇怪,这是行不通的。或许可以找到或翻译从 here 到 R/Shiny 的解决方案。
这是按钮的 title
选项:
library(shiny)
library(DT)
ui <- fluidPage(
br(),
DTOutput("DT")
)
server <- function(input, output) {
output$DT <- renderDT({
mtcars %>%
datatable(., extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
buttons = list(
list(
extend = "copy",
text = "COPY",
title = NULL
)
)
)
)
})
}
shinyApp(ui = ui, server = server)