Fixed issue 20352. Do not remove an invalid value from the selector.
authorAntonio Moreno <antonio.moreno@openbravo.com>
Thu, 26 Apr 2012 17:29:26 +0200
changeset 16512 46f6c549a415
parent 16511 4a738ea029c9
child 16513 071251abc7ed
Fixed issue 20352. Do not remove an invalid value from the selector.
Reverted change done in changeset bcbda0ffe5d8. This change was causing the following behaviour to happen:
- When a field is used as part of a displaylogic of a different field, a redraw of the window will be done in case the selector value happens.
- This redraw will cause a call to the mapValueToDisplay method.
- If the user is typing the name of the business partner, the value will not be one of the valid business partner names (yet).
- With the previous version of the method, the value was then discarded. This produced the very annoying effect of reverting what the user had typed just after he had done it, if he hadn't been 'fast enough' to type the whole identifier of the business partner.
With the change done, the selector will not be cleared if a user types a (not yet completely correct) value in the selector, even if there is a valueMap which doesn't contain what the user has typed.
The issue which was supposedly fixed with this part of the mentioned changeset (issue 19724) still works fine as far as I can tell, even after having removed this part of the change.
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Fri Apr 20 09:11:01 2012 +0200
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Thu Apr 26 17:29:26 2012 +0200
@@ -669,14 +669,10 @@
     if (ret === value && this.isDisabled()) {
       return '';
     }
-    if (ret === value) {
-      if (!this.valueMap) {
-        this.valueMap = {};
-        this.valueMap[value] = '';
-        return '';
-      } else if (!this.valueMap[value]) {
-        return '';
-      }
+    if (ret === value && !this.valueMap) {
+      this.valueMap = {};
+      this.valueMap[value] = '';
+      return '';
     }
     return ret;
   },