闪亮:无法在闪亮的数据表中设置列宽

rot*_*otz 1 r datatables shiny

我对 Shiny 和 DataTables 很陌生,所以这可能是一个愚蠢的问题。由于某种原因,我无法更改列宽。我试过

 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"))
              )
)
Run Code Online (Sandbox Code Playgroud)

但它不起作用(我可以说,因为列的宽度不同)。我也尝试使用旧的aoColumnDefsandbAutoWidth和 setting autoWidth=FALSE,但都不起作用。

我的 DT 有 33 列,所以也许是因为在 Shiny 中显示 DT 时有总宽度限制?无论如何,如果有人能帮我解决这个问题,那将是非常有帮助的。

谢谢!

Car*_*arl 6

您需要scrollX=TRUE按照https://github.com/rstudio/DT/issues/29添加选项