michael-s-molina commented on code in PR #21317:
URL: https://github.com/apache/superset/pull/21317#discussion_r981122791


##########
superset-frontend/src/explore/actions/saveModalActions.js:
##########
@@ -40,6 +40,17 @@ export function fetchDashboards(userId) {
           value: id,
           label: (json.result[index] || {}).dashboard_title,
         }));
+        choices.sort((a, b) => {
+          const labelA = a.label.toUpperCase();
+          const labelB = b.label.toUpperCase();
+          if (labelA < labelB) {
+            return -1;
+          }
+          if (labelA > labelB) {
+            return 1;
+          }
+          return 0;

Review Comment:
   @agl-developer What you're trying to achieve is a concept called [Natural 
Sorting](https://en.wikipedia.org/wiki/Natural_sort_order). This is already 
supported natively by 
[localeCompare](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare)
 using `{ sensitivity: 'base', numeric: true }`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to