Related to issue 17323: When you enter the product, the cursor jumps to the qty but the value in the field is not selected.
authorMartin Taal <martin.taal@openbravo.com>
Thu, 21 Jul 2011 18:17:33 +0200
changeset 13239 c3aabcc39ede
parent 13238 b2f11fac6056
child 13240 6c10bfc2134c
Related to issue 17323: When you enter the product, the cursor jumps to the qty but the value in the field is not selected.
Now also handles date fields or other compound fields if they are the field to which the focus jumps
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Thu Jul 21 17:36:04 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Thu Jul 21 18:17:33 2011 +0200
@@ -414,9 +414,6 @@
   setFocusInForm: function() {
     if (this.getFocusItem() && this.getFocusItem().isFocusable()) {
       this.getFocusItem().focusInItem();
-      if (this.getFocusItem().doRestoreSelection) {
-        this.getFocusItem().doRestoreSelection();
-      }
       this.view.lastFocusedItem = this.getFocusItem();
       return;
     }
@@ -1267,8 +1264,13 @@
       // checks if a mouseevent was the cause of the selection
       // in which case the selection is not update, .select()
       // does what we want
-      if (!isc.isA.TextAreaItem(nextItem) && nextItem.getElement()) {
-        nextItem.getElement().select();
+      if (!isc.isA.TextAreaItem(nextItem)) {
+        if (nextItem.getElement()) {
+          nextItem.getElement().select();
+        } else {
+          // works for date values
+          nextItem.selectValue();
+        }
       }
     }
   },