From 2ab8bba4b01ab941481b0d3b0881a88c6ec819b3 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 1 Mar 2023 15:22:57 +0100 Subject: [PATCH] Sort null and undefined at the bottom in data-table (#15651) Sort null and undefined at the bottom in datatable --- src/components/data-table/sort_filter_worker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/data-table/sort_filter_worker.ts b/src/components/data-table/sort_filter_worker.ts index 36e756f91e..8fcb9cc3ae 100644 --- a/src/components/data-table/sort_filter_worker.ts +++ b/src/components/data-table/sort_filter_worker.ts @@ -67,11 +67,11 @@ const sortData = ( } } - // Ensure "undefined" is always sorted to the bottom - if (valA === undefined && valB !== undefined) { + // Ensure "undefined" and "null" are always sorted to the bottom + if (valA == null && valB != null) { return 1; } - if (valB === undefined && valA !== undefined) { + if (valB == null && valA != null) { return -1; }