icflorescu / icflorescu/mantine-datatable

Add opt-in independentColumnResizing so a resize drag changes only the dragged column

Open
#833 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

Current behavior

Column resizing is zero-sum. In DataTableResizableHeaderHandle, a drag grows the dragged column by shrinking its immediate right-hand neighbor by the same amount (setMultipleColumnWidths writes both {accessor, width} entries, delta clamped by Math.max(-maxShrinkCurrent, Math.min(deltaX, maxShrinkNext))). Two consequences:

  1. Widening a column crushes the neighbor, so laying out a wide table means fixing every column downstream of the one being adjusted — each fix steals from the next.
  2. The last column can't be resized at all. Two independent gates enforce this: DataTableHeader strips the prop from the final leaf column (resizable={resizable && index < columns.length - 1}), and the handle's mousedown bails when there is no next resizable sibling to take width from.
Use case

Operators arranging a wide, horizontally-scrolling data table want to size one column without disturbing a layout they already set, and want to widen a column into the existing horizontal scroll rather than at a neighbor's expense. They also expect the rightmost column to be resizable like any other.

Proposed semantics — new opt-in DataTable prop independentColumnResizing?: boolean (default false, preserving today's behavior)

When enabled:

  • A drag writes only the dragged column's width, clamped against its own min width with no upper bound.
  • The table's total width (already the sum of pixel widths under the fixed-layout lock) grows or shrinks into horizontal overflow; neighbors are untouched.
  • Both last-column gates are dropped, so the rightmost column is resizable.
  • Release persists only the dragged column's width.
  • Double-click-to-reset and reset-columns restore the fluid auto layout unchanged.

Accepted trade-off: shrinking columns can leave blank space to the right of the table when the total drops below the viewport width.

We currently ship exactly this as a patch-package patch against 9.4.0 (verified working, including persistence and reset) and would prefer to adopt it as a first-class prop. Happy to open a PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DataTableResizableHeaderHandle and DataTableHeader, then trace how the DataTable prop reaches column resizing, persistence, and reset behavior. Implement the opt-in independentColumnResizing path while preserving the default zero-sum behavior; done means only the dragged column changes, the last column resizes, persistence stores that width, and reset actions retain their existing fluid layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.