question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Columns resize on updated props

See original GitHub issue

When using column resizing, the first column grows and the others shrink when data is manipulated.

I’m passing the data in as props so that may be causing the table to re-render and recalculate the widths.

Expected Behavior

When new props are passed and data is updated, the columns should not recalculate their widths.

Current Behavior

Every time an action is performed the first column appears to grow in width. This causes all others to shrink in width and is impractical to resize each column to get them to return to normal.

This happens during adding/removing rows, or editing cells. You can also import the same file over and over and watch the behavior as well.

Steps to Reproduce (for bugs)

column-resizing

  1. visit: https://klappy.github.io/tsv-editor/
  2. Use this file to import after removing the .txt as it only supports .tsv files. example.tsv.txt
  3. Click in a field to “edit”.
  4. “Tab” to cycle through next and previous cells to see resizing.

You can also clone the repo and after npm i and npm start you can run locally. https://github.com/klappy/tsv-editor

Your Environment

Tech Version
Material-UI ^3.9.2
MUI-datatables ^2.0.0-beta-54
React ^16.8.2
browser latest Chrome on Mac
etc

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gregnbcommented, Feb 26, 2019

No worries @klappy thanks for the feedback. Honestly, I have noticed this issue for a while now and I don’t have a great approach on fixing it yet. I would love for someone to pitch in on this one since I’m strapped for time

1reaction
klappycommented, Feb 26, 2019

@gregnb My apologies that my first feedback is a bug. I use this frequently in my PoCs and Prototypes. This is an excellent project and I am appreciative of the amazing pace at which feature and bugs are addressed! Excellent job delivering and maintaining such a versatile component!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Column Resizing Feature Guide - Material React Table Docs
Material React Table lets you easily change the default widths (sizes) of columns and has a built-in column resizing draggable handle feature.
Read more >
react resize fixed-data-table from nonstatic columns
The resize function resizes the width of each column based on a state change. However, I need to build the state or columns...
Read more >
column-resizer - npm
It is used to set how the resize method works. Those are the possible values: 'fit' : this is default resizing model, in...
Read more >
Build an Ag-Grid React Component that ... - DEV Community ‍ ‍
This post will share an Ag-Grid wrapper component that will resize columns sizes to fit its container's width automatically.
Read more >
Build an Ag-Grid React Component that Auto Resize Columns ...
If its container size changes, it will resize the columns to fit the new width. ... The component props of this component extend...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found