-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in Grid sorting, null values not handled in sortMultiple function (when sortMode=multiple) #2157
Comments
I am also experiencing this issue, additionally the null values appear to break the sort so that even without the null values the rows are out of order. The issue is resolved if sortMode=multiple is removed. Additionally, should null values be sorted to the bottom of the table, regardless of asc or desc sort order? |
Please note this issue can be fixed by applying a sort function rather than using the table's default sort function. I used this one from a previous issue: However I am not sure how to import Objectutils. I ended up copying and pasting the resolveFieldData and isFunction methods. |
Unfortunately this issue wasn't fixed yet and can't be solved by #348 in our case. In my opinion the implementations of the primereact datatable's sorting functions for single and multiple sort should treat the null values in the same way. Currently the null values are only treated correctly for "sortSingle", but not for "sortMultiple". In the case of multiple columns selected the sort function of the datatable.js file treats NULL-values as number values. The code is as follows in the function "multisortField" of datatable.js: while the function "sortSingle" is currently implemented as follows for the datatable.js: At the moment the only workaround for this is to hand over all null-values as empty strings to the datatable, but this has consequences in other parts of our application. Is there a chance that issue will be solved in a future version of primereact? |
PR Submitted |
I'm submitting a ... (check one with "x")
Codesandbox Case (Bug Reports)
Please fork the codesandbox below and create a case demonstrating your bug report. Issues without a codesandbox have much less possibility to be reviewed.
https://codesandbox.io/s/wonderful-lederberg-2cvgy?file=/src/demo/DataTableSortDemo.js
Current behavior
Sorting not working properly when sortMode=multiple
Expected behavior
It's should be sort properly all types of data don't matter user sorting single or multiple sorts when sortMode=multiple
primereact/src/components/datatable/DataTable.js
Line 701 in b0de52a
The text was updated successfully, but these errors were encountered: