details:   /erp/devel/pi/rev/81d63e6a5e2a
changeset: 9940:81d63e6a5e2a
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Wed Jan 19 15:27:17 2011 +0100
summary:   Prevent length call on undefined getSelectedRecords

details:   /erp/devel/pi/rev/4c26ab0b2fa9
changeset: 9941:4c26ab0b2fa9
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Wed Jan 19 15:27:50 2011 +0100
summary:   Reenabled paused retrieval of child info

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
 |  17 +++++++++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
       |   2 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
     |  15 +++++--
 3 files changed, 27 insertions(+), 7 deletions(-)

diffs (89 lines):

diff -r 1137ca113624 -r 4c26ab0b2fa9 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Wed Jan 19 15:25:51 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
      Wed Jan 19 15:27:50 2011 +0100
@@ -623,6 +623,21 @@
     this.setTabButtonState(state);
   },
   
+  // do refresh contents with a small delay to not refresh child views
+  // to quick when walking through a grid with arrow keys
+  // only do this if this view is not in a dirty state
+  doPausedRefreshContents: function(doRefreshWhenVisible) {
+    if (this.isShowingForm && this.viewForm.hasChanged) {
+      this.doRefreshContents(doRefreshWhenVisible);
+    } else {
+      var me = this, callback = function () {
+        me.doRefreshContents(doRefreshWhenVisible);
+      };
+      // wait 2 times longer than the fire on pause delay default
+      this.fireOnPause('doRefreshContents_' + this.ID, callback, 
this.fireOnPauseDelay * 2);
+    }
+  },
+  
   doRefreshContents: function(doRefreshWhenVisible){
 
     // update this one at least before bailing out
@@ -946,7 +961,7 @@
     if (this.childTabSet) {
       for (var i = 0; i < this.childTabSet.tabs.length; i++) {
         tabViewPane = this.childTabSet.tabs[i].pane;
-        tabViewPane.doRefreshContents(true);
+        tabViewPane.doPausedRefreshContents(true);
       }
     }
     // and recompute the count:
diff -r 1137ca113624 -r 4c26ab0b2fa9 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
    Wed Jan 19 15:25:51 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
    Wed Jan 19 15:27:50 2011 +0100
@@ -565,7 +565,7 @@
     var buttons = this.getRightMembers();
     var numOfSelRecords = this.view.viewGrid.getSelectedRecords().length;
     var isNew = this.view.viewForm.isNew;
-    var hideAllButtons = numOfSelRecords !== 1 && !isNew;
+    var hideAllButtons = !isNew && (!this.view.viewGrid.getSelectedRecords() 
|| this.view.viewGrid.getSelectedRecords().length !== 1);
     var currentValues = this.view.getCurrentValues();
     
     for (var i = 0; i < buttons.length; i++) {
diff -r 1137ca113624 -r 4c26ab0b2fa9 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Wed Jan 19 15:25:51 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Wed Jan 19 15:27:50 2011 +0100
@@ -472,7 +472,9 @@
       var index1, index2, errorCode, view = form.view;
       var status = resp.status;
       if (status === isc.RPCResponse.STATUS_SUCCESS) {
-      
+        // needs to be done before the selectRecordById
+        this.setAutoSaveFormInActiveView(null);
+
         // do remember values here to prevent infinite autosave loop
         form.rememberValues();
         
@@ -480,13 +482,15 @@
         
         if (form.isNew) {
           view.viewGrid.updateRowCountDisplay();
+          // tell the grid to select this record and not open 
           view.viewGrid.targetRecordId = data.id;
+          view.showGridForTargetRecord = true;
           view.viewGrid.filterData(view.viewGrid.getCriteria());
+        } else {
+          // after save the grid selection seems to have gone, repair it
+          view.viewGrid.selectRecordById(data.id);
         }
         
-        // after save the grid selection seems to have gone, repair it
-        view.viewGrid.selectRecordById(data.id);
-        
         this.setNewState(false);
         this.setHasChanged(false);
 
@@ -532,7 +536,8 @@
       }
       form.inAutoSave = false;
       form.isSaving = false;
-      view.setToolBarButtonState();
+      form.view.setToolBarButtonState();
+      this.setAutoSaveFormInActiveView(null);
       return;
     } else {
       // remove the error message if any

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
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