details:   https://code.openbravo.com/erp/devel/pi/rev/82e40910201d
changeset: 26854:82e40910201d
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Jun 04 14:54:06 2015 +0200
summary:   Fixes issue 30062: Grid is properly loaded after refreshing with a 
selected row

The problem was caused by this code (the this attribute is a ResultSet), which 
is contained in the fetchRemoteData function:

      } else if (this.grid.refreshingWithSelectedRecord) {
        // if the grid was refreshed with a record selected, use the range that 
contained that record
        //  instead of using targetRecordId to improve the performance
        startRow = this.grid.selectedRecordInitInterval;
        endRow = this.grid.selectedRecordEndInterval;
      }

If the grid is refreshed while one of its records is selected, then the 
startRow and endRow will be set so that the requested page contains the 
selected record. The problem was that the ResultSet.localData attribute was not 
being properly set, as at this points it was expected to contain the 'loading' 
value for all the rows that are being requested. As a result of this the 
localData attribute became malformed when the response was processed, and this 
caused the grid to misbehave.

To fix this, the localData is configured to wait for the proper records:

        this.localData = [];
        this.setRangeLoading(startRow, endRow);

diffstat:

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

diffs (14 lines):

diff -r 0a83fa5e05c1 -r 82e40910201d 
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
     Thu Jun 04 12:25:19 2015 +0000
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Thu Jun 04 14:54:06 2015 +0200
@@ -217,6 +217,10 @@
         //  instead of using targetRecordId to improve the performance
         startRow = this.grid.selectedRecordInitInterval;
         endRow = this.grid.selectedRecordEndInterval;
+        // the startRow and endRow are being modified, so the localData 
attribute also
+        // needs to be updated to wait for the proper records
+        this.localData = [];
+        this.setRangeLoading(startRow, endRow);
       }
       return this.Super('fetchRemoteData', arguments);
     },

------------------------------------------------------------------------------
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to