Bläddra i källkod

HUE-5390 [assist] Fix for incorrect column order

Caused by unstable sort in Chrome.
Johan Ahlen 9 år sedan
förälder
incheckning
1749cef
1 ändrade filer med 5 tillägg och 6 borttagningar
  1. 5 6
      desktop/core/src/desktop/static/desktop/js/assist/assistDbEntry.js

+ 5 - 6
desktop/core/src/desktop/static/desktop/js/assist/assistDbEntry.js

@@ -339,12 +339,11 @@ var AssistDbEntry = (function () {
         self.entries(newEntries);
         self.entries()[0].open(true);
       } else {
-        newEntries.sort(function (a, b) {
-          if (a.definition.isColumn && b.definition.isColumn) {
-            return 0;
-          }
-          return a.definition.name.localeCompare(b.definition.name);
-        });
+        if (newEntries.length > 0 && !newEntries[0].definition.isColumn) {
+          newEntries.sort(function (a, b) {
+            return a.definition.name.localeCompare(b.definition.name);
+          });
+        }
         self.entries(newEntries);
       }
       if (typeof callback === 'function') {