r - R Shiny:如何在 DT::renderDataTable 中添加分页
问题描述
我正在尝试在我的 R Shiny 应用程序中添加分页、搜索框和选择器,但它现在不起作用(我尝试了分页 = TRUE 和搜索 = TRUE,在选项中你可以在下面看到但它不起作用) . 你知道我应该添加什么吗?
output$mytable1 <- DT::renderDataTable(
DT::datatable(
{ plots.dfs()[[1]] },
caption = htmltools::tags$caption(
style = 'caption-side: bottom; text-align: center;',
'Table 2: ', htmltools::em('This is a simple caption for the table.')
),
extensions = 'Buttons',
options = list(
paging = TRUE,
searching = TRUE,
fixedColumns = TRUE,
autoWidth = TRUE,
ordering = TRUE,
dom = 'tB',
buttons = c('copy', 'csv', 'excel')
),
class = "display"
))
我已经添加了我现在拥有的表格的屏幕截图以及预期的表格。感谢您的帮助] 1
解决方案
可以修改dom
参数,例如如下:
DT::datatable(
{ mtcars },
caption = htmltools::tags$caption(
style = 'caption-side: bottom; text-align: center;',
'Table 2: ', htmltools::em('This is a simple caption for the table.')
),
extensions = 'Buttons',
options = list(
fixedColumns = TRUE,
autoWidth = TRUE,
ordering = TRUE,
dom = 'Bftsp',
buttons = c('copy', 'csv', 'excel')
))
要添加页面长度,还要添加l
到字符串。希望这可以帮助!
推荐阅读
- azure - Azure 应用程序 ID 和对象 ID 有什么区别
- python - 用于将 csv 数据写入 Amazon DynamoDB 表的 AWS lambda 函数
- macros - SPSS中用于排序和线性插值数据的循环
- php - 如何在命令外壳中创建一个虚拟控制器传递给组件 CakePHP 2.4.3
- jquery - 视差滚动仅适用于顶部元素
- c# - 有没有办法可以简化这个正则表达式?
- django - 通过简单字段和/或多字段过滤对详细视图的访问
- c - 我的代码有什么问题。我没有得到所需的输出。当在其中一个在线编译器中执行此代码时,它没有提供所需的输出
- python - [Python][Adobe Acrobat]将PDF另存为Excel问题
- huawei-mobile-services - HUAWEI Push-获取访问令牌的API不起作用