-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
When using DataTable with reorderableColumns, column ordering works correctly when controlled via props and when using drag & drop independently.
However, after performing a drag & drop reorder, updating the column order again via props (e.g. using a “shuffle” button) no longer works correctly.
The component appears to keep an internal column order state after drag & drop that is no longer synchronized with the column order provided via props.
Reproducer
https://stackblitz.com/edit/umv9mwqp?file=src%2FApp.jsx
System Information
primereact: 10.9.7
react: 18.3.1Steps to reproduce the behavior
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.