闪亮:无法在闪亮数据表中设置列宽 [英] Shiny: Unable to set column width in Shiny DataTables
问题描述
输出$ table< -DT :: renderDataTable(
{withProgress(message =Compiling,
{dataInput()}
)
},
filter =top,
rownames = FALSE,
options = list(lengthMenu = c ,10,25,50,100),
pageLength = 25,
searchHighlight = TRUE,
autoWidth = TRUE,
columnDefs = list(list(width =200px,targets = _all))
)
)
但它不工作(我可以知道,因为列的宽度不同)。我还尝试使用旧的 aoColumnDefs
和 bAutoWidth
,并设置 autoWidth = FALSE
,但都不起作用。
我的DT有33列,所以也许是因为在闪亮显示DTs时总共有宽度限制?无论如何,如果有任何人可以帮助我解决这个问题,这将是非常有帮助的。
谢谢!
您需要根据 scrollX = TRUE 问题/ 29rel =nofollow> https://github.com/rstudio/DT/issues/29
I'm pretty new to Shiny and DataTables, so this might be a silly question. I cannot change the column width for some reason. I tried
output$table<-DT::renderDataTable(
{withProgress(message="Compiling",
{dataInput()}
)
},
filter="top",
rownames=FALSE,
options=list(lengthMenu=c(5,10,25,50,100),
pageLength=25,
searchHighlight=TRUE,
autoWidth=TRUE,
columnDefs=list(list(width="200px",targets="_all"))
)
)
but it doesn't work (I can tell because the columns have different widths). I also tried using the old aoColumnDefs
and bAutoWidth
, and setting autoWidth=FALSE
, but neither works.
My DT has 33 columns, so maybe it's because there's a total width limit when displaying DTs in Shiny? Anyway, it would be extremely helpful if anyone can help me solve this problem.
Thanks!
You need to add scrollX=TRUE
in the options as per https://github.com/rstudio/DT/issues/29
这篇关于闪亮:无法在闪亮数据表中设置列宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!