我在更改下载的csv名称时遇到问题,使用datatable包的扩展按钮,我想要de csv的自定义名称,我正在尝试使用JS选项来编写JavaScript代码,但我是没有成功
library(DT)
datatable(head(iris, 30),
extensions = 'Buttons',
options = list(
dom = 'Bfrtip',
buttons = list(list(extend = 'collection', buttons = c('csv','pdf'),text = 'Descarga'))
),
callback = JS("
{
extend: csv,
text: Save Log Info,
filename: download1}
"))
答案 0 :(得分:3)
配置应直接在选项中:
DT::datatable(
mtcars,
options = list(
dom = 'Bfrtip',
buttons = list(
list(
extend = 'csv',
text = "Save Log Info",
title = 'download1'
),
'pdf'
)
),
extensions = 'Buttons',
)