[英]How do I suppress row names when using DT::renderDataTable in R shiny?
As per the explanation in section 2.3 here , I can remove rownames for a datatable by setting rownames = FALSE
根据此处 2.3节的说明,我可以通过设置
rownames = FALSE
来删除数据表的行名
How do I suppress row names when using DT::renderDataTable
in R shiny? 在R
DT::renderDataTable
中使用DT::renderDataTable
时,如何DT::renderDataTable
行名? The following doesn't work because if you look at the dataTables options reference there is no rownames option 以下内容不起作用,因为如果您查看dataTables选项参考 ,则没有行名选项
output$subsettingTable <- DT::renderDataTable(
subsetTable(), filter = 'top', server = FALSE,
options = list(pageLength = 5, autoWidth = TRUE, rownames= FALSE
))
My question is similar to the one here . 我的问题类似于这里的问题 。 The answers there are for
renderTable
and I've tried making the answers there work with DT::renderDataTable
with zero success. 那里的答案是
renderTable
,我尝试过使DT::renderDataTable
的答案成功为零。
Please be very careful to read the help pages of functions to know which argument belongs to which function. 请非常仔细地阅读函数的帮助页面,以了解哪个参数属于哪个函数。 In your case, the
rownames
argument belongs to the datatable()
function, but you actually put it inside the options
argument, and that is certainly wrong. 在您的情况下,
rownames
参数属于datatable()
函数,但实际上将其放在options
参数中,这肯定是错误的。 DT::renderDataTable()
accepts either a data object or a table widget as its first argument (again, please read its help page), so either of the following expressions should work: DT::renderDataTable()
接受数据对象或表小部件作为其第一个参数(同样,请阅读其帮助页面),因此以下两种表达式均应起作用:
DT::renderDataTable(datatable(
subsetTable(), filter = 'top', server = FALSE,
options = list(pageLength = 5, autoWidth = TRUE),
rownames= FALSE
))
DT::renderDataTable(
subsetTable(), filter = 'top', server = FALSE,
options = list(pageLength = 5, autoWidth = TRUE),
rownames= FALSE
)
In the latter case, rownames = FALSE
is passed to datatable()
internally, per documentation of the ...
argument of the help page. 在后一种情况下,根据帮助页面的
...
参数的文档,行名rownames = FALSE
在内部传递给datatable()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.