Open karkianish opened 2 months ago
From looking at the source code if you use onSort it looks like it thinks you are in Cotrolled mode you are controlling the sorting paging and filtering where without it the table controls it all internally.
So its just returning your current original sort value on the column back to you.
@melloware - thanks for looking into it. I feel that the eventargs
should be populated accurately and users should get to decide how sort will be handled with available information. The fieldname
is populated correctly in the same eventargs object.
ps - since the issue is still categorized as Bug
, I am assuming your comment above is giving more info about the problem rather than advocating the current behavior not being an issue.
Correct.
Describe the bug
The value of
sortOrder
property in DataTableStateEvent is always 1. The expected behavior is the value should vary between 1 | 0 | -1 depending on sort order.Reproducer
https://stackblitz.com/edit/a6xx6a?file=src%2FApp.jsx
System Information
System: OS: Windows 11 10.0.22631 CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-1370P Memory: 8.72 GB / 31.66 GB Binaries: Node: 21.6.1 - ~\scoop\apps\nvm\current\nodejs\nodejs\node.EXE npm: 10.2.4 - ~\scoop\apps\nvm\current\nodejs\nodejs\npm.CMD Browsers: Edge: Spartan npmPackages: primereact: ^10.8.2 => 10.8.2 react: ^18 => 18.2.0 tailwindcss: ^3.4.7 => 3.4.7
Steps to reproduce the behavior
onSort
callback for the data tablesortOrder
property in console (logged from step 3)Expected behavior
The value of
sortOrder
property should alternate 1 | 0 | -1 to indicate asc/desc sort order.