You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57
Current behavior
DataTable correctly indicates initial sortField and sortOrder in header: "num" descending here. But the actual data is not sorted, the numbers are ascending:
This happens for both sortField or sortFunction.
But if you do
then you'd see that DataTable does in fact sort data initially, just ignoring sortField/sortFunction. This is especially painful, since it makes it harder to work around the problem by presorting the data yourself.
Expected behavior
DataTable should consult sortField/sortFunction.
You could click the "num" header twice, toggling the sortOrder, resorting the data. Then you'd see the correctly sorted data, as it should be after the initial render:
Minimal reproduction of the problem with instructions
Open linked codesandbox. See incorrectly sorted data.
Please tell us about your environment:
React version:
PrimeReact version:
6.5.0, 7.1.0
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Language: [all | TypeScript X.X | ES6/7 | ES5]
The text was updated successfully, but these errors were encountered:
…umnSortable and columnSortFunction refs when processing data. Otherwise, the refs are false and undefined, which results in the sortFunction not being run initially.
* Fix#2514: If sortField is specified, determine and set columnSortable and columnSortFunction refs when processing data. Otherwise, the refs are false and undefined, which results in the sortFunction not being run initially.
* Update var to const.
I'm submitting a ... (check one with "x")
Codesandbox Case (Bug Reports)
https://codesandbox.io/s/datatable-ignores-sortfunction-and-sortfield-for-initial-sorting-4kuxe
Current behavior
DataTable correctly indicates initial sortField and sortOrder in header: "num" descending here. But the actual data is not sorted, the numbers are ascending:
This happens for both sortField or sortFunction.
But if you do
then you'd see that DataTable does in fact sort data initially, just ignoring sortField/sortFunction. This is especially painful, since it makes it harder to work around the problem by presorting the data yourself.
Expected behavior
DataTable should consult sortField/sortFunction.
You could click the "num" header twice, toggling the sortOrder, resorting the data. Then you'd see the correctly sorted data, as it should be after the initial render:
Minimal reproduction of the problem with instructions
Open linked codesandbox. See incorrectly sorted data.
Please tell us about your environment:
React version:
PrimeReact version:
6.5.0, 7.1.0
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
Language: [all | TypeScript X.X | ES6/7 | ES5]
The text was updated successfully, but these errors were encountered: