primefaces / primefaces/primereact

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

Open
#8,477 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Triage
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
  1. Open the StackBlitz reproducer

  2. Click the Shuffle Columns button → Columns reorder correctly

  3. Drag & drop any column to change its order → Columns reorder correctly

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.