details:   https://code.openbravo.com/erp/devel/pi/rev/8b7a6ede079c
changeset: 21924:8b7a6ede079c
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Feb 06 09:53:55 2014 +0100
summary:   Fixes bug 25666: Columns are not wrongly updated when chaging rows 
in the grid

This issue happened when the user clicked on a record (this triggers a FIC 
call) and then clicked on another record before the FIC response was received. 
What
was happening is that the FIC response was applied on the currently selected 
row, not on the row that trigger the FIC call. This has been fixed by checking 
bef
ore the FIC response is processed if the selected row has changed.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 |  18 +++++++--
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 407f2d03251e -r 8b7a6ede079c 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Wed Feb 05 17:19:02 2014 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
 Thu Feb 06 09:53:55 2014 +0100
@@ -2184,7 +2184,7 @@
   setContextInfo: function (sessionProperties, callbackFunction, forced) {
     var newCallback, me = this,
         gridVisibleProperties = [],
-        len, i;
+        len, i, originalID;
     // no need to set the context in this case
     if (!forced && (this.isEditingGrid || this.isShowingForm)) {
       if (callbackFunction) {
@@ -2198,13 +2198,23 @@
       sessionProperties = this.getContextInfo(false, true, false, true);
     }
 
+    if (this.viewGrid && this.viewGrid.getSelectedRecord()) {
+      originalID = this.viewGrid.getSelectedRecord()[OB.Constants.ID];
+    }
+
     newCallback = function (response, data, request) {
       var context = {},
-          grid = me.viewGrid;
-      context.rowNum = grid.getRecordIndex(grid.getSelectedRecord());
+          grid = me.viewGrid,
+          currentRecord, currentID;
+      currentRecord = grid.getSelectedRecord();
+      context.rowNum = grid.getRecordIndex(currentRecord);
+      currentID = currentRecord[OB.Constants.ID];
       context.grid = grid;
       response.clientContext = context;
-      grid.processFICReturn(response, data, request);
+      if (originalID === currentID) {
+        // Only update the grid if the user has not changed rows
+        grid.processFICReturn(response, data, request);
+      }
       if (callbackFunction) {
         callbackFunction();
       }

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to