Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ Suggests:
V8
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Config/testthat/edition: 3
Config/roxygen2/version: 8.0.0
9 changes: 8 additions & 1 deletion R/columns.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#' Cells in the row names column are automatically marked up as row headers.
#' @param minWidth Minimum width of the column in pixels. Defaults to 100.
#' @param maxWidth Maximum width of the column in pixels.
#' @param initWidth Initial width of the column in pixels.
#' @param width Fixed width of the column in pixels. Overrides `minWidth` and `maxWidth`.
#' @param align Horizontal alignment of content in the column. One of
#' `"left"`, `"right"`, `"center"`. By default, all numbers are right-aligned,
Expand All @@ -78,7 +79,7 @@
#'
#' If a sticky column is in a column group, all columns in the group will
#' automatically be made sticky, including the column group header.
#'
#'
#' Sticky columns do not work if `fullWidth` is set to `FALSE` in `reactable()`.
#' @param class Additional CSS classes to apply to cells. Can also be an R function
#' that takes the cell value, row index, and column name as arguments, or a [JS()]
Expand Down Expand Up @@ -142,6 +143,7 @@ colDef <- function(
rowHeader = FALSE,
minWidth = 100,
maxWidth = NULL,
initWidth = NULL,
width = NULL,
align = NULL,
vAlign = NULL,
Expand Down Expand Up @@ -256,6 +258,10 @@ colDef <- function(
stop("`maxWidth` must be numeric")
}

if (!is.null(initWidth) && !is.numeric(initWidth)) {
stop("`initWidth` must be numeric")
}

if (!is.null(width) && !is.numeric(width)) {
stop("`width` must be numeric")
}
Expand Down Expand Up @@ -338,6 +344,7 @@ colDef <- function(
rowHeader = if ("rowHeader" %in% userArgs) rowHeader,
minWidth = if ("minWidth" %in% userArgs) minWidth,
maxWidth = maxWidth,
initWidth = initWidth,
width = width,
align = align,
vAlign = vAlign,
Expand Down
6 changes: 6 additions & 0 deletions inst/htmlwidgets/reactable.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15,828 changes: 15,827 additions & 1 deletion inst/htmlwidgets/reactable.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/htmlwidgets/reactable.js.map

Large diffs are not rendered by default.

92,223 changes: 92,221 additions & 2 deletions inst/htmlwidgets/reactable.server.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/htmlwidgets/reactable.server.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions man/colDef.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/reactable-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/reexports.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions srcjs/columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ export function buildColumnDefs(columns, groups, tableProps = {}) {
col.vAlign = col.vAlign || 'top'
col.headerVAlign = col.headerVAlign || 'top'

const { width, minWidth, maxWidth } = col
const { width, initWidth, minWidth, maxWidth } = col
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change can be removed.

col.minWidth = getFirstDefined(width, minWidth, 100)
col.maxWidth = getFirstDefined(width, maxWidth, Number.MAX_SAFE_INTEGER)

// maxWidth takes priority over minWidth
col.minWidth = Math.min(col.minWidth, col.maxWidth)

// Start column width at min width / flex width, like in v6
col.width = col.minWidth
col.width = col.initWidth || col.minWidth

col.resizable = getFirstDefined(col.resizable, resizable)
// Disable resizing on fixed width columns
Expand Down