details:   https://code.openbravo.com/erp/devel/pi/rev/6011273d6efb
changeset: 24322:6011273d6efb
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Mon Aug 25 13:39:40 2014 +0200
summary:   Fixes issue 27368: Tab key not working properly in process/parameter 
window

The problem was that the form was being directly redrawn in the 
handleItemChange function, and that cannot be done because otherwise the form 
is not able to move the focus to the next parameter.

A timeout is needed to ensure that the availability of the ok button is updated 
after the redrawal of the form because:
- the availability of the ok button must be updated after the form redrawal
- at this point the form cannot be directly redrawn because otherwise the focus 
does not behave properly, that's why markForRedraw is used
- there is no way to assign a callback to the markForRedraw function

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js
 |  19 ++++-----
 1 files changed, 9 insertions(+), 10 deletions(-)

diffs (36 lines):

diff -r 0bd1540f6c0d -r 6011273d6efb 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js
      Mon Aug 25 14:49:59 2014 +0530
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js
      Mon Aug 25 13:39:40 2014 +0200
@@ -39,7 +39,7 @@
   // this function is invoked on the blur action of the formitems
   // this is the proper place to execute the client-side callouts
   handleItemChange: function (item) {
-    var affectedParams, i, field;
+    var affectedParams, i, field, me = this;
     // Execute onChangeFunctions if they exist
     if (this && OB.OnChangeRegistry.hasOnChange(this.paramWindow.viewId, 
item)) {
       OB.OnChangeRegistry.call(this.paramWindow.viewId, item, 
this.paramWindow, this, this.paramWindow.viewGrid);
@@ -58,15 +58,14 @@
     }
     // evaluate explicitly the display logic for the grid fields
     this.paramWindow.handleDisplayLogicForGridColumns();
-    // force a redraw to reevaluate the display logic of the parameters
-    // if possible the redraw should be done before setting the availability 
of the ok button
-    // if the updated item is a date/datetime, then it is not possible to do a 
redraw at this point, because in that case the focus does not go properly to 
the next parameter
-    if (isc.SimpleType.getType(item.type).inheritsFrom === 'date' || 
isc.SimpleType.getType(item.type).inheritsFrom === 'datetime') {
-      this.markForRedraw();
-    } else {
-      this.redraw();
-    }
-    
this.paramWindow.okButton.setEnabled(this.paramWindow.allRequiredParametersSet());
+    this.markForRedraw();
+    // this timeout is needed to ensure that the availability of the ok button 
is updated after the redrawal of the form because:
+    // - the availability of the ok button must be updated after the form 
redrawal
+    // - at this point the form cannot be directly redrawn because otherwise 
the focus does not behave properly, that's why markForRedraw is used
+    // - there is no way to assign a callback to the markForRedraw function
+    setTimeout(function () {
+      
me.paramWindow.okButton.setEnabled(me.paramWindow.allRequiredParametersSet());
+    }, 200);
   },
 
   setFieldSections: function () {

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to