Fixes issue 19805: Fix function that sorts an array by the length property
authorAugusto Mauch <augusto.mauch@openbravo.com>
Mon, 27 Feb 2012 11:30:01 +0100
changeset 15625 4d25a7e6f421
parent 15624 5d04ccfa2cd8
child 15626 7d8d2c37c269
Fixes issue 19805: Fix function that sorts an array by the length property

To decide which field should be automatically expanded in the field, the array that contains all the fields is sorted by the length property. Then the available field with the highest length will the one being auto expanded. The function used to sort the array was faulty, now it is fixed: it puts first in descending order the fields that have defined the length property, and after them it puts the fields that do not have that property defined.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Mon Feb 27 11:18:21 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Mon Feb 27 11:30:01 2012 +0100
@@ -2108,12 +2108,12 @@
         return 0;
       }
       if (!t1) {
+        return 1;
+      }
+      if (!t2) {
         return -1;
       }
-      if (!t2) {
-        return 1;
-      }
-      if (t1 < t2) {
+      if (t1 > t2) {
         return -1;
       } else if (t1 === t2) {
         return 0;