Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column width not change after reorder in datatable #3139

Closed
lio016 opened this issue Aug 5, 2022 · 3 comments · Fixed by #4410
Closed

Column width not change after reorder in datatable #3139

lio016 opened this issue Aug 5, 2022 · 3 comments · Fixed by #4410
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@lio016
Copy link

lio016 commented Aug 5, 2022

Describe the bug

If I just modify column order it works fine: the column size goes with the modified column. But if i modify column order after i modified the column width, the column width doesn't go with the column, so that the column width don't change.

Reproducer

https://codesandbox.io/s/datatable-reorder-vrlt9g

PrimeReact version

8.3.0

React version

18.x

Language

ES6

Build / Runtime

Create React App (CRA)

Browser(s)

Chrome 103.0.5060.134, Firefox: 103.0.1, Microsoft Edge: 103.0.1264.77

Steps to reproduce the behavior

orig columnWidths from the datatable session state: columnWidths: "59,74,290,44,71"

  1. Modify a column width
  2. Modify the column order from position 3 to 2
    new columnWidths from the datatable session state: columnWidths: "59,74,290,44,71"

Expected behavior

If I modify column order from 3 to 2) after I modified a column width, the column widths change.
For example (with datatable session state):
orig columnWidths: "59,74,290,44,71"
new columnWidths: "59,290,74,44,71"

@lio016 lio016 added Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component. labels Aug 5, 2022
@mertsincan mertsincan removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 25, 2022
@shuklabhisekh
Copy link
Contributor

Hey @mertsincan @melloware, I've created a PR(#4410) for this Issue. Please review it and let me know if I need to change anything.

@melloware
Copy link
Member

Thank you for the contribution! I assigned Mert to review since this is a pretty complex one.

@melloware melloware added this to the 10.0.0 milestone Aug 11, 2023
melloware added a commit that referenced this issue Aug 11, 2023
…e column it is displacing (#4410)

* After resizing and reordering column takes the size of the column it is displacing

* fixed eslint issue

* After resizing and reordering column takes the size of the column it is displacing

* fixed eslint issue

* formatted Datable.js

* refactored

* fixed lint issue

---------

Co-authored-by: Melloware <mellowaredev@gmail.com>
@melloware
Copy link
Member

Great PR thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
4 participants