details:   https://code.openbravo.com/erp/devel/pi/rev/2b5c09bed087
changeset: 21271:2b5c09bed087
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Oct 10 17:41:32 2013 +0200
summary:   Fixes issue 24924: Changes are applied to the grid with adaptive 
filtering

When a record was updated in form view with the record filtered using adaptive 
filtering, the changes were not being applied to the grid. This happened 
because the changes were being applied to the allRows property of the 
ResultSet, but not to the localData property, which is what contains the data 
of the filtered records.

diffstat:

 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
 |  18 ++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diffs (28 lines):

diff -r aa0a3079ce66 -r 2b5c09bed087 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- 
a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Thu Oct 10 14:30:03 2013 +0200
+++ 
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Thu Oct 10 17:41:32 2013 +0200
@@ -90,6 +90,24 @@
         }
       }
     }
+  },
+
+  _original_updateCacheData: isc.ResultSet.getPrototype().updateCacheData,
+  updateCacheData: function (updateData, dsRequest) {
+    var filteringOnClient = this.allRows !== null,
+        i, indexAllRows, indexLocalData, ds;
+    this._original_updateCacheData(updateData, dsRequest);
+    if (filteringOnClient) {
+      ds = this.getDataSource();
+      // remove any rows that were present in the cache
+      for (i = 0; i < updateData.length; i++) {
+        indexLocalData = ds.findByKeys(updateData[i], this.localData);
+        indexAllRows = ds.findByKeys(updateData[i], this.allRows);
+        if (indexLocalData !== -1 && indexAllRows !== -1) {
+          this.localData[indexLocalData] = this.allRows[indexAllRows];
+        }
+      }
+    }
   }
 });
 

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to