react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Resize flex columns on (column) resize

Open nstepien opened this issue 3 years ago • 1 comments

Recording 2022-09-17 at 17 40 58 Recording 2022-09-17 at 17 42 15

There is a bug that after resizing, then scrolling, flex columns can snap back to their newly measured width (content-dependent). Maybe we need re-save measured widths after resizing. This won't re-flex columns when toggling columns for example, maybe this can be controlled in a parent state.

nstepien avatar Sep 17 '22 16:09 nstepien

Codecov Report

Merging #3029 (7361da3) into main (44ac8c7) will increase coverage by 0.47%. The diff coverage is 73.56%.

:exclamation: Current head 7361da3 differs from pull request most recent head dac0e41. Consider uploading reports for the commit dac0e41 to get more accurate results

@@            Coverage Diff             @@
##             main    #3029      +/-   ##
==========================================
+ Coverage   93.24%   93.71%   +0.47%     
==========================================
  Files          40       41       +1     
  Lines        1303     1337      +34     
  Branches      405      411       +6     
==========================================
+ Hits         1215     1253      +38     
+ Misses         88       84       -4     
Impacted Files Coverage Δ
src/hooks/useGridDimensions.ts 81.81% <40.00%> (-18.19%) :arrow_down:
src/hooks/useColumnWidths.ts 71.42% <71.42%> (ø)
src/DataGrid.tsx 92.82% <100.00%> (+2.78%) :arrow_up:
src/HeaderCell.tsx 90.00% <100.00%> (+17.14%) :arrow_up:
src/hooks/useCalculatedColumns.ts 100.00% <100.00%> (ø)
src/hooks/useViewportColumns.ts 82.85% <100.00%> (-2.86%) :arrow_down:

codecov[bot] avatar Sep 30 '22 16:09 codecov[bot]

Anything I could do to help get this in? It's exactly the feature I was needing.

truk avatar Jan 05 '23 19:01 truk

@truk, we haven't finalized if the current approach is the best solution. You can test it in the meantime if everything is working as expected

amanmahajan7 avatar Jan 09 '23 20:01 amanmahajan7

Yeah, I guess the first thing is just to understand the scope of what this is. It looks like it's the ability to have the columns just auto-grow beyond the content width when there's space, though this doesn't cause columns to shrink and clip the text below the content width based on any relative sizes. I think the latter would be a useful feature so you could have some columns that can flex up and down and some fixed. And for this to be a column property rather than some default. I'm also noticing the scroll bug still in this branch, so maybe it's not done yet.

truk avatar Jan 17 '23 20:01 truk

Can this be merged ? I also need this feature

JanBN avatar Mar 26 '23 17:03 JanBN

@amanmahajan7 I'll review it tomorrow

nstepien avatar May 01 '23 16:05 nstepien