details:   https://code.openbravo.com/erp/devel/pi/rev/4ccdae6e5989
changeset: 23938:4ccdae6e5989
user:      Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date:      Mon Jun 30 21:10:52 2014 +0530
summary:   Fixes Issue 26696 : Adaptive filtering works properly

When performing local filtering, always compare with identifier as the grid 
contains only the id and identifier.

diffstat:

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

diffs (40 lines):

diff -r a7df81ce980c -r 4ccdae6e5989 
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
  Mon Jun 30 14:44:55 2014 +0000
+++ 
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Mon Jun 30 21:10:52 2014 +0530
@@ -166,6 +166,36 @@
     } else {
       return this._original_shouldUseClientSorting();
     }
+  },
+  _original_filterLocalData: isc.ResultSet.getPrototype().filterLocalData,
+  // when filtering locally use identifier as the fieldName as the grid 
contains only identifier property.
+  // refer issue https://issues.openbravo.com/view.php?id=26696.
+  filterLocalData: function () {
+    var newProperty, i, j, localCriteria, fieldName;
+    if (this.criteria && this.criteria.criteria) {
+      for (i = 0; i < this.criteria.criteria.length; i++) {
+        if (this.criteria.criteria[i].fieldName) {
+          fieldName = this.criteria.criteria[i].fieldName;
+          if (fieldName.indexOf(OB.Constants.FIELDSEPARATOR) !== -1) {
+            newProperty = fieldName.substring(0, 
fieldName.indexOf(OB.Constants.FIELDSEPARATOR) + 1);
+            newProperty = newProperty + OB.Constants.IDENTIFIER;
+            this.criteria.criteria[i].fieldName = newProperty;
+          }
+          //when more than one records are selected, update the subcriteria 
also
+          if (this.criteria.criteria[i].criteria) {
+            localCriteria = this.criteria.criteria[i].criteria;
+            for (j = 0; j < localCriteria.length; j++) {
+              if (localCriteria[j].fieldName && 
localCriteria[j].fieldName.indexOf(OB.Constants.FIELDSEPARATOR) !== -1) {
+                newProperty = localCriteria[j].fieldName.substring(0, 
fieldName.indexOf(OB.Constants.FIELDSEPARATOR) + 1);
+                newProperty = newProperty + OB.Constants.IDENTIFIER;
+                localCriteria[j].fieldName = newProperty;
+              }
+            }
+          }
+        }
+      }
+    }
+    return this._original_filterLocalData();
   }
 });
 

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to