Fixes issue 19176: Grid editing problem
authorMartin Taal <martin.taal@openbravo.com>
Wed, 30 Nov 2011 14:29:38 +0100
changeset 14768 75d0f48b9623
parent 14767 736b6c531d88
child 14769 598bceb6e1a9
child 14770 4d7988468158
Fixes issue 19176: Grid editing problem
While the editor form is shown in the grid all kinds of focus/blur events happen together with validation, this results in redraws, the code change prevents the validation and
resulting redraws while the editor is being shown
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js	Wed Nov 30 14:13:40 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js	Wed Nov 30 14:29:38 2011 +0100
@@ -429,6 +429,12 @@
   blur: function(){
     var value;
     
+    // prevent validation/blurhandling when we are showing the editor and moving
+    // the focus around
+    if (this.form && this.form.grid && this.form.grid._showingEditor) {
+      return;
+    }
+
     if (this.doBlurLogic) {
       this.validate();  
 
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Nov 30 14:13:40 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Nov 30 14:29:38 2011 +0100
@@ -2140,8 +2140,8 @@
     
     var ret = this.Super('showInlineEditor', [rowNum, colNum, newCell, newRow, suppressFocus]);
     
-    delete this._showingEditor;
     if (!newRow) {
+      delete this._showingEditor;
       return ret;
     }
     
@@ -2183,6 +2183,7 @@
     
     this.view.messageBar.hide();
     
+    delete this._showingEditor;
     return ret;
   },
   
--- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Wed Nov 30 14:13:40 2011 +0100
+++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Wed Nov 30 14:29:38 2011 +0100
@@ -376,7 +376,18 @@
 
   // disable tab to icons
   canTabToIcons: false,
-  
+
+  _original_validate: isc.FormItem.getPrototype().validate,
+  validate: function() {
+    
+    // prevent validation when we are showing the editor and moving
+    // the focus around
+    if (this.form && this.form.grid && this.form.grid._showingEditor) {
+      return;
+    }
+    return this._original_validate();
+  },
+
   _original_init: isc.FormItem.getPrototype().init,
   init: function() {
     this.obShowIf = this.showIf; // Copy the reference of showIf definition