diff --git a/src/components/data-table/sort_filter_worker.ts b/src/components/data-table/sort_filter_worker.ts index 1c04338a3c..01389feee3 100644 --- a/src/components/data-table/sort_filter_worker.ts +++ b/src/components/data-table/sort_filter_worker.ts @@ -58,6 +58,14 @@ const sortData = ( valB = valB.toUpperCase(); } + // Ensure "undefined" is always sorted to the bottom + if (valA === undefined && valB !== undefined) { + return 1; + } + if (valB === undefined && valA !== undefined) { + return -1; + } + if (valA < valB) { return sort * -1; }