details:   /erp/devel/pi/rev/d391390e97ec
changeset: 9680:d391390e97ec
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Mon Jan 10 17:05:02 2011 +0100
summary:   Made grid not wait for save

details:   /erp/devel/pi/rev/1d6d36cbdf6b
changeset: 9681:1d6d36cbdf6b
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Mon Jan 10 17:05:19 2011 +0100
summary:   Solved wrong inheritance usage in formitem

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
 |  52 +++++----
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
        |   8 +-
 2 files changed, 34 insertions(+), 26 deletions(-)

diffs (148 lines):

diff -r 3804c55c985a -r 1d6d36cbdf6b 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Mon Jan 10 15:33:42 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Mon Jan 10 17:05:19 2011 +0100
@@ -103,7 +103,7 @@
     this.instanceClearIcon = isc.shallowClone(this.clearIcon);
     this.instanceClearIcon.formItem = this;
     
-    this.instanceClearIcon.showIf= function(form, item){
+    this.instanceClearIcon.showIf = function(form, item){
       if (item.disabled) {
         return false;
       }
@@ -123,7 +123,7 @@
       this.formItem.setValue(null);
       this.formItem.form.itemChangeActions();
     };
-
+    
     this.icons = [this.instanceClearIcon];
     
     return this.Super('init', arguments);
@@ -278,7 +278,7 @@
   showDisabled: false,
   
   // never disable a section item
-  isDisabled: function() {
+  isDisabled: function(){
     return false;
   }
 });
@@ -739,7 +739,7 @@
     var newValidators = [];
     // get rid of the isFloat validators, as we have 
     // specific validation based on the format definition
-    for (var i =0; i < this.validators.length; i++) {
+    for (var i = 0; i < this.validators.length; i++) {
       if (this.validators[i].type !== 'isFloat') {
         newValidators.push(this.validators[i]);
       }
@@ -754,7 +754,7 @@
   getMaskNumeric: function(){
     return this.typeInstance.maskNumeric;
   },
-
+  
   getDecSeparator: function(){
     return this.typeInstance.decSeparator;
   },
@@ -778,7 +778,7 @@
   },
   
   // focus changes the formatted value to one without grouping
-  focusNumberInput: function(){    
+  focusNumberInput: function(){
     var oldCaretPosition = 0;
     if (this.getSelectionRange()) {
       oldCaretPosition = this.getSelectionRange()[0];
@@ -850,12 +850,12 @@
     }
     return true;
   },
-    
+  
   keyDown: function(item, form, keyName){
     var keyCode = OB.Utilities.getKeyCode();
     this.manageDecPoint(keyCode);
   },
-
+  
   validateOBNumberItem: function(){
     var value = this.getElementValue();
     var isValid = this.valueValidator.condition(this, this.form, value);
@@ -884,7 +884,7 @@
     return this.Super('focus', arguments);
   },
   
-  handleEditorExit: function() {
+  handleEditorExit: function(){
     var ret = this.Super('handleEditorExit', arguments);
     return ret;
   },
@@ -911,10 +911,10 @@
       
       
       // return a formatted value, if it was valid
-      if (isc.isA.String(value)) {        
+      if (isc.isA.String(value)) {
         if (OB.Utilities.Number.IsValidValueString(type, value)) {
           this.resultingValue = OB.Utilities.Number.OBMaskedToJS(value, 
type.decSeparator, type.groupSeparator);
-          return true; 
+          return true;
         } else {
           return false;
         }
@@ -954,18 +954,22 @@
     }
   },
   
-  blur: function(form, item){
-    if (form && form.handleItemChange) {
-      form.handleItemChange(this);
-    }
-    this._hasChanged = false;
-    return this.Super('blur', arguments);
-  },
-  
-  isDisabled: function() {
-    if (this.readOnly) {
-      return true;
-    }
-    return this.Super('isDisabled', arguments);
+  init: function(){
+    this._originalIsDisabled = this.isDisabled;
+    this.isDisabled = function(){
+      if (this.readOnly) {
+        return true;
+      }
+      return this._originalIsDisabled();
+    };
+    
+    this._originalBlur = this.blur;
+    this.blur = function(form, item){
+      if (form && form.handleItemChange) {
+        form.handleItemChange(this);
+      }
+      this._hasChanged = false;
+      return this._originalBlur(form, item);
+    };
   }
 });
diff -r 3804c55c985a -r 1d6d36cbdf6b 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Mon Jan 10 15:33:42 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Mon Jan 10 17:05:19 2011 +0100
@@ -107,8 +107,12 @@
   // internal sc grid property, see the ListGrid source code
   preserveEditsOnSetData: false,
   
-  waitForSave: true,
-  stopOnErrors: true,
+  // enabling this results in a slower user interaction
+  // it is better to allow fast grid interaction and if an error occurs
+  // dismiss any new records being edited and go back to the edit row 
+  // which causes the error
+  //waitForSave: true,
+  //stopOnErrors: true,
   confirmDiscardEdits: true,
   
   canMultiSort: false,

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to