Table: Cannot select header to reorder when both reorder and resize are enabled.
Describe the bug
Up to v20, both reorderableColumns & resizableColumns features work just fine. However in v21, trying to drag the column header results in "highlighting" & not reordering.
To get reordering to work, i figured now i need to highlight some/part of the header texts, before reordering works.
Pull Request Link
No response
Reason for not contributing a PR
- [ ] Lack of time
- [x] Unsure how to implement the fix/feature
- [x] Difficulty understanding the codebase
- [ ] Other
Other Reason
No response
Reproducer
https://stackblitz.com/edit/bhgocanp?file=src%2Fapp%2Ftable-reorder-demo.html,src%2Fmain.ts,src%2Findex.html,package.json
Environment
Win 11, Chrome latest
Angular version
21.0.3
PrimeNG version
v21
Node version
22.18.0
Browser(s)
Version 142.0.7444.176 (Official Build) (64-bit)
Steps to reproduce the behavior
Try re-ordering the columns.
Expected behavior
Able to reorder columns without highlighting the header.
I was having the same issue. I found that wrapping the children of <th> in a div fixes the problem.
For instance, with the Reproducer code above change:
<th *ngFor="let col of columns" pResizableColumn pReorderableColumn>
{{col.header}}
</th>
To:
<th *ngFor="let col of columns" pResizableColumn pReorderableColumn>
<div>
{{col.header}}
</div>
</th>
This also works if you have p-sortIcon and p-columnFilter components within the <th> element. Just move them within the new div element as well.
I am not sure why this works, but it does for me. I hope this helps someone else.
This issue has been automatically marked as stale due to a lack of activity. If this issue is still relevant to you, please leave a comment so we can keep it open. We apologize for not being able to prioritize it sooner. If you have any new information or questions, please share them in your comment!