10BC0 DataTable: column order via props breaks after drag & drop reorder · Issue #8476 · primefaces/primereact · GitHub
[go: up one dir, main page]

Skip to content

DataTable: column order via props breaks after drag & drop reorder #8476

@paol-imi

Description

@paol-imi

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.1

Steps 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs TriageIssue will be reviewed by Core Team and a relevant label will be added as soon as possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0