2

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!

rotz
  • 53
  • 1
  • 9
  • If you are using the CRAN version of `DT`, try installing the dev version from here `devtools::install_github('rstudio/DT')` and then give it a shot – Sumedh Jul 07 '16 at 17:30
  • No, still not working after installing the dev version. – rotz Jul 07 '16 at 17:39
  • This is strange: I tried assigning random strings that make no sense to the `width` parameter, and it still presents the same output as the code above would. – rotz Jul 07 '16 at 18:01

1 Answers1

8

You need to add scrollX=TRUE in the options as per https://github.com/rstudio/DT/issues/29

Carl
  • 5,569
  • 6
  • 39
  • 74