闪亮:无法在闪亮数据表中设置列宽 [英] Shiny: Unable to set column width in Shiny DataTables

查看:184
本文介绍了闪亮:无法在闪亮数据表中设置列宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆