reactable icon indicating copy to clipboard operation
reactable copied to clipboard

Question : If resizable = TRUE and colDef(width) are used, resizable disabled.

Open daeyoonlee opened this issue 4 years ago • 2 comments

Thanks for the great package.

Currently setting width in colDef seems to disable resizable. minwidth and maxwidth are also forced. Is this intentional? I want to width only as an initial value and allow resizable. but there seems to be no way. If only min width and maxwidth are used, resizable is possible, but the initial value is minwidth.

library(shiny)
library(reactable)

ui <- fluidPage(
  reactableOutput(outputId = "table"),
)

server <- function(input, output, session) {
  
  output$table <- renderReactable(
    reactable(
      data = iris,
      bordered = TRUE,
      resizable = TRUE,
      columns = list(
        Species = colDef(minWidth = 150, width = 200, maxWidth = 250)
      )
    )
  )
  
}

shinyApp(ui, server)

image

daeyoonlee avatar Jan 17 '22 03:01 daeyoonlee

Yes, this was intentional, or at least semi-intentional when resizing was reworked to respect the min and max widths of columns. Disabling resizing on fixed-width columns wasn't a primary intention, but came along with that rework. I can see how resizing would be useful on fixed-width columns though.

Unfortunately, resizing can't be easily reenabled on fixed-width columns without undoing the work to limit resizing to min/max widths. It's somewhat complicated, so I'll tag this as a feature request to look into later for now.

glin avatar Feb 20 '22 23:02 glin

thank you for the reply. If modifying the width option is complicated, it may be an alternative to add initWidth to the option. That is, if width is provided, initWidth is ignored(fixed width), if width is not provided and initWidth is provided, then initWidth is initialized. (in this case resizable should be possible)

daeyoonlee avatar Feb 21 '22 01:02 daeyoonlee