details:   https://code.openbravo.com/erp/devel/pi/rev/6e7fbc189b5d
changeset: 24107:6e7fbc189b5d
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Jul 23 09:46:04 2014 +0200
summary:   fixed bug 27157: multi-requests in summary functions in saved 
view/grid config

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
 |  16 ++++++++-
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (48 lines):

diff -r 8e48dc870c2c -r 6e7fbc189b5d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Wed Jul 23 08:50:45 2014 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Wed Jul 23 09:46:04 2014 +0200
@@ -1036,7 +1036,7 @@
   },
 
   setViewState: function (state, settingDefault) {
-    var localState, i, fld, hasSummaryFunction;
+    var localState, i, fld, hasSummaryFunction, hasDefaultSavedView;
 
     localState = this.evalViewState(state, 'viewState');
 
@@ -1049,6 +1049,10 @@
       return;
     }
 
+    // by default, there are no summary functions
+    hasSummaryFunction = false;
+    this.setShowGridSummary(false);
+
     if (this.getDataSource()) {
       // old versions stored selected records in grid view, this can cause
       // problems if record is not selected yet
@@ -1066,9 +1070,7 @@
             delete fld.summaryFunction;
           }
         }
-        this.setShowGridSummary(hasSummaryFunction);
       }
-
       // remove focus as this results in blur behavior before the
       // (filter)editor is redrawn with new fields when
       // doing setviewstate
@@ -1103,6 +1105,14 @@
 
       this.Super('setViewState', ['(' + isc.Comm.serialize(localState, false) 
+ ')']);
 
+      hasDefaultSavedView = this.view && this.view.standardWindow && 
this.view.standardWindow.checkIfDefaultSavedView();
+      if (hasSummaryFunction && (!settingDefault || !hasDefaultSavedView)) {
+        // setting summary functions only once, if not causes several requests 
(see issue #27157)
+        // it is set when setting saved view, or setting defaults (grid 
configuration) if there is no saved view
+        this.recalculateGridSummary();
+        this.setShowGridSummary(true);
+      }
+
       // Focus on the first filterable item
       if (this.view.isActiveView()) {
         this.focusInFirstFilterEditor();

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to