primefaces / primefaces/primereact
DataTable: column order via props breaks after drag & drop reorder
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When using DataTable with reorderable columns, column ordering works correctly either via props or via drag & drop.
However, after a drag & drop reorder occurs, updating the column order again via props no longer works correctly.
This makes it impossible to reliably control column order from external state once the user interacts with column reordering.
Reproducer
https://stackblitz.com/edit/umv9mwqp?file=src%2FApp.jsx
System Information
primereact: 10.9.7
react: 18.3.1
Steps to reproduce the behavior
-
Open the StackBlitz reproducer
-
Click the Shuffle Columns button → Columns reorder correctly
-
Drag & drop any column to change its order → Columns reorder correctly
-
Click the Shuffle Columns button again → Column order does not update correctly / remains stuck
Expected behavior
After using drag & drop to reorder columns, updating the column order via props (e.g. clicking the Shuffle button) should still reorder the columns according to the provided prop/state order.
The DataTable should remain fully controllable by external column state even after user interaction.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproducer and the DataTable column-reordering behavior described in the issue. Reproduce the sequence of shuffling, dragging a column, and shuffling again, then trace how the externally provided column order is handled after drag and drop. Done means the second Shuffle updates the DataTable to the provided state order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100