primefaces / primereact

The Most Complete React UI Component Library
https://primereact.org
MIT License
7k stars 1.06k forks source link

DataTable: re-order + resizable fails #6599

Closed Holgrabus closed 6 months ago

Holgrabus commented 6 months ago

Describe the bug

When we have resizableColumns + reorderableColumns options activated, the column re-order is failing.

It duplicates the first column 2 times and set the moved column at the end.

Example: Before NAME | COUNTRY | AGENT | DATE | BALANCE | STATUS | ACTIVITY

I tried to move AGENT before COUNTRY After

NAME | NAME | COUNTRY | DATE | BALANCE | STATUS | ACTIVITY | NAME | AGENT

I forked an example from your doc and only added these 2 options.

Reproducer

https://stackblitz.com/edit/qhavtj?file=src%2FApp.jsx

PrimeReact version

10.6.5

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

Chrome 124

Steps to reproduce the behavior

It's very easy, just drag and drop a column (any column) and you will see a duplicate of the first one.

Expected behavior

Reorder columns, not create duplicates.

Rekl0w commented 6 months ago

Duplicate of #6558.

Holgrabus commented 6 months ago

Ok I got it, the answer is: add a "field" property to each column.