details: https://code.openbravo.com/erp/devel/pi/rev/bb721685f50a changeset: 30872:bb721685f50a user: Naroa Iriarte <naroa.iriarte <at> openbravo.com> date: Mon Dec 12 16:10:29 2016 +0100 summary: Fixed issue 33853: There were too much DS request
When a column with a summary function was set, if any of the grid columns was reordered, there were three DS requests triggered. To fix the problem two different things have been done. The first, in ob-view-grid.js, consists on setting the showGridSummary property to false before the call to the function "reorderField" of the Super- This avoids one flow of smartclient which was, at the end, triggering two DS requests. The second approach is also in ob-view-grid, but also in ob-grid. The problem was that when the ob-grid.getSummaryRow function was invoked, the return statement was calling the "getSummaryRow" function of the Super. There, once again a DS request was triggered. To fix this, a new object has been created. This object contains three properties. One of them is a property which is true if the columns have been reordered. Now, in the ob-grid.getSummaryRow, if that property is true and if there is a summary function, the summary row is returned. diffstat: modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js | 4 ++++ modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js | 9 +++++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diffs (34 lines): diff -r a2651b1e5d31 -r bb721685f50a modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js Wed Dec 14 12:35:05 2016 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js Mon Dec 12 16:10:29 2016 +0100 @@ -900,6 +900,10 @@ // creates (or updates) and returns the summaryRow autoChild // not called directly -- call 'setShowGridSummary' instead getSummaryRow: function () { + if (this.summaryRow && this.summaryRowProperties.isBeingReordered) { + this.summaryRow.reorderField(this.summaryRowProperties.oldPosition, this.summaryRowProperties.newPosition); + return this.summaryRow; + } if (this.lazyFiltering && this.summaryRow) { if (this.getSummaryRowDataSource && this.completeFields) { this.summaryRow.setDataSource(this.getSummaryRowDataSource(), this.completeFields.duplicate()); diff -r a2651b1e5d31 -r bb721685f50a 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 Dec 14 12:35:05 2016 +0100 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js Mon Dec 12 16:10:29 2016 +0100 @@ -977,7 +977,16 @@ }, reorderField: function (fieldNum, moveToPosition) { + this.summaryRowProperties = {}; + this.summaryRowProperties.isBeingReordered = true; + this.summaryRowProperties.oldPosition = fieldNum; + this.summaryRowProperties.newPosition = moveToPosition; + this.showGridSummary = false; var res = this.Super('reorderField', arguments); + this.setShowGridSummary(true); + delete this.summaryRowProperties.isBeingReordered; + delete this.summaryRowProperties.oldPosition; + delete this.summaryRowProperties.newPosition; this.view.standardWindow.storeViewState(); return res; }, ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits