fixes issue 31293: current combo value is not selected when opening drop down
authorCarlos Aristu <carlos.aristu@openbravo.com>
Thu, 05 Nov 2015 16:44:29 +0100
changeset 28101 239c6606f978
parent 28100 c6bfc013b9d1
child 28102 bba4162b09e1
fixes issue 31293: current combo value is not selected when opening drop down

The problem is caused because after the combo refactor project table and tabledir references make use of a class with different behavior (OBFKComboItem).

Together with this, currently in the FormItem class there is a logic on the _shouldSelectOnFocus method which performs the selection just when tabbing through the form, or on programmatic focus, but not on mouse click. This is the main reason why the text is not being selected when clicking on the drop-down in form view for any reference.

In order to have a common behavior for all the combos in both grid and form view, we are overriding the showPicker() method of OBComboBoxItem to ensure that we select the text after clicking on the drop-down
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-combo.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-combo.js	Thu Nov 05 11:55:31 2015 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-combo.js	Thu Nov 05 16:44:29 2015 +0100
@@ -35,5 +35,12 @@
     ret = this.Super('filterComplete', arguments);
     delete this.preventValidation;
     return ret;
+  },
+
+  // Override showPicker to ensure that we select the text when clicking on the drop-down
+  // See issue #31274
+  showPicker: function () {
+    this.selectValue();
+    this.Super('showPicker', arguments);
   }
 });
\ No newline at end of file