Skip to content

Add initWidth argument to colDef#425

Merged
glin merged 1 commit into
glin:mainfrom
nteetor:main
Jun 16, 2026
Merged

Add initWidth argument to colDef#425
glin merged 1 commit into
glin:mainfrom
nteetor:main

Conversation

@nteetor

@nteetor nteetor commented May 25, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds an initWidth column to the colDef function. As described in #223 and #374 there isn't currently a way to specify a column's initial width and allow column resizing.

I adjusted the javascript column logic to set width to initWidth, if specified. The behavior of the other width arguments remain unchanged.

Changes

  • Added initWidth argument to colDef()
  • Added argument checks in colDef() for the following,
    • initWidth is null or numeric
    • initWidth and width cannot both be specified
    • if specified, initWidth is greater than or equal to minWidth
    • if specified, initWidth is less than or equal to minWidth
  • Added R tests
    • confirm argument checks listed above
  • Added Javascript tests
    • confirm initial width does not affect min or max width
    • initial width leaves a resizable column as resizable

Comment thread srcjs/columns.js Outdated
@nteetor nteetor marked this pull request as ready for review May 27, 2026 07:37
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.47%. Comparing base (9b7b409) to head (8296117).
⚠️ Report is 78 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #425      +/-   ##
==========================================
- Coverage   95.88%   92.47%   -3.42%     
==========================================
  Files          11       19       +8     
  Lines        1191     2471    +1280     
  Branches        0      733     +733     
==========================================
+ Hits         1142     2285    +1143     
- Misses         49      160     +111     
- Partials        0       26      +26     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@glin glin left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks good, thanks. I'll follow up with a NEWS Item too, but won't/can't push to your main branch:

  • colDef() gains an initWidth argument to set a column's initial width in pixels while keeping the column resizable. Unlike width, which sets a fixed width and disables resizing, initWidth only sets the starting width, so the column can still be resized within its minWidth and maxWidth. (@nteetor, #223, #374)

edit: done in 4a43839

@glin glin merged commit 0aba5af into glin:main Jun 16, 2026
10 checks passed
@nteetor

nteetor commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Great news, thank you, @glin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants