setting column width

setting column width

white_rabbitwhite_rabbit Posts: 9Questions: 3Answers: 0

I'd like to set the column width to adjust automatically for the column contents. I tried this code but it didn't work.

output$book_table <- DT::renderDT(RVTables$book %>% filter(deal==1),
selection = 'single',
editable = TRUE,
rownames = FALSE,
options=list(
#drawCallback = I("function( settings ) {document.getElementById('ex1').style.width = '600px';}"),
autoWidth=TRUE,
ordering=FALSE,
pageLength=12,
scrollX = TRUE,
scrollY = TRUE,
bLengthChange= FALSE,
searching=FALSE
)
)

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @white_rabbit ,

    We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • white_rabbitwhite_rabbit Posts: 9Questions: 3Answers: 0

    Hi Colin, i'm using datatable in a R shiny app so its not so easy to share a working version. I'll take a look at the references and see what I can do.
    thanks
    hugh

  • white_rabbitwhite_rabbit Posts: 9Questions: 3Answers: 0

    Here's the R code I'm using:

    output$book_table <- DT::renderDT(RVTables$book %>% filter(deal==as.numeric(input$deal_choice)), selection = list(mode="single",selected=row_edited), editable = TRUE, rownames = FALSE, options=list( #drawCallback = I("function( settings ) {document.getElementById('ex1').style.width = '600px';}"), autoWidth=TRUE, ordering=FALSE, pageLength=12, scrollX = TRUE, scrollY = TRUE, bLengthChange= FALSE, searching=FALSE ) )

This discussion has been closed.