Sort null and undefined at the bottom in data-table (#15651)

Sort null and undefined at the bottom in datatable
This commit is contained in:
Paul Bottein 2023-03-01 15:22:57 +01:00 committed by GitHub
parent 1a1c00ba62
commit 2ab8bba4b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,11 +67,11 @@ const sortData = (
} }
} }
// Ensure "undefined" is always sorted to the bottom // Ensure "undefined" and "null" are always sorted to the bottom
if (valA === undefined && valB !== undefined) { if (valA == null && valB != null) {
return 1; return 1;
} }
if (valB === undefined && valA !== undefined) { if (valB == null && valA != null) {
return -1; return -1;
} }