primefaces / primefaces/primereact

DataTable: dynamic column order did not work after manually drag/drop column for ordering.

Open
#6,341 0 comments 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

Initially, you can sort columns by clicking a button. Then, you can manually rearrange the table by dragging and dropping. However, after clicking the button, the dynamic column sorting stops working.

Reproducer

https://codesandbox.io/p/sandbox/amazing-jennings-z27r2m?file=%2Fsrc%2Fdemo%2FDataTableReorderDemo.js%3A16%2C30

PrimeReact version

10.6.2

React version

17.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior
  1. Go to Sandbox https://codesandbox.io/p/sandbox/amazing-jennings-z27r2m?file=%2Fsrc%2Fdemo%2FDataTableReorderDemo.js%3A16%2C30
  2. Click on "Reorder Column" button at top-left-below page. This will reorder the column randomly.
  3. Then manually drag and drop the table header to re-order the column (i.e. reorder "Quantity", "Name", "Category", "Code")
  4. Click on "Reorder Column" button again. The reorder will stop working.
Expected behavior

The column header should be able to be sorted dynamically after manually drag & drop.

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 CodeSandbox entry point, DataTableReorderDemo.js, and reproduce the sequence of clicking "Reorder Column," manually dragging a header, then clicking the button again. Trace the DataTable column-reordering behavior involved in that sequence; done means dynamic reordering still works after manual drag-and-drop, while preserving the demonstrated behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.