【发布时间】:2018-10-06 22:17:36
【问题描述】:
我正在尝试在我的 R Shiny 应用程序的表格上方添加下载按钮('copy'、'csv'、'excel'、'pdf'),但在使用内部数据表时,renderDataTable 似乎不起作用。
output$mytable1 <- DT::renderDataTable(
datatable(
{ plots.dfs()[[1]] },
rownames = TRUE,
options = list(
fixedColumns = TRUE,
autoWidth = TRUE,
ordering = FALSE,
dom = 'tB',
buttons = c('copy', 'csv', 'excel', 'pdf')
),
class = "display"
))
当我在没有 DT::datatable 的情况下使用 DT::renderDataTable 时,renderDataTable 运行良好,并且我拥有所有功能(过滤器、搜索字段等),除了下载按钮(我要添加的)
output$mytable1 = DT::renderDataTable({ plots.dfs()[[1]] })
你知道我做错了什么吗?感谢您的帮助
【问题讨论】:
-
您的
datatable()中的extensions = 'Buttons'命令在哪里? -
谢谢,按钮现在出现了,但是所有的 renderDataTable 功能都消失了(列过滤器、搜索框、行选择、分页等)......你知道如何让它们重新出现吗? ?
-
检查 table 希望您的功能在绿色框中。
-
我使用的是 Firefox Quantum 59.0.2(64 位)。当我只使用 renderDataTable 一切正常(但当然,按钮不存在) output$mytable1 = DT::renderDataTable({ plots.dfs()[[1]] })
-
所以没有
extensions参数,所有功能都可以工作?