details:   https://code.openbravo.com/erp/devel/pi/rev/da5f8acef63a
changeset: 14087:da5f8acef63a
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Wed Oct 26 15:02:48 2011 +0200
summary:   Fixes issue 18860: Disable auto filter on entering expression filter 
character

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
                 |  21 ++++++++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
            |   1 -
 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
 |   8 +++
 3 files changed, 26 insertions(+), 4 deletions(-)

diffs (82 lines):

diff -r 5f39a1051539 -r da5f8acef63a 
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 Oct 26 13:37:44 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Wed Oct 26 15:02:48 2011 +0200
@@ -245,7 +245,7 @@
         }
         return ret;
       },
-
+      
       // overridden for:
       // https://issues.openbravo.com/view.php?id=18509
       editorChanged : function (item) {
@@ -253,6 +253,14 @@
           actOnKeypress = item.actOnKeypress === true ? item.actOnKeypress : 
this.actOnKeypress;
         
         if (this.sourceWidget.allowFilterExpressions && val && actOnKeypress) {
+          
+          // if someone starts typing and and or then do not filter
+          // onkeypress either
+          if (val.contains(' and') || val.contains(' or')) {
+            this.preventPerformFilterFiring();
+            return;
+          }
+          
           // now check if the item element value is only
           // an operator, if so, go away
           opDefs = isc.DataSource.getSearchOperators();
@@ -265,9 +273,9 @@
                 continue;
               }
               
-              same = opDefs[prop].symbol && 
-                (opDefs[prop].symbol === val || 
opDefs[prop].symbol.startsWith(val));
+              same = opDefs[prop].symbol && 
val.startsWith(opDefs[prop].symbol);
               if (same) {
+                this.preventPerformFilterFiring();
                 return;
               }
             }
@@ -276,6 +284,13 @@
         return this.Super('editorChanged', arguments);
       },
       
+      // function called to clear any pending performFilter calls
+      // earlier type actions can already have pending filter actions
+      // this deletes them
+      preventPerformFilterFiring: function() {
+        this.fireOnPause("performFilter", {}, this.fetchDelay);
+      },
+      
       // repair that filter criteria on fk fields can be 
       // on the identifier instead of the field itself.
       // after applying the filter the grid will set the criteria
diff -r 5f39a1051539 -r da5f8acef63a 
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 Oct 26 13:37:44 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
     Wed Oct 26 15:02:48 2011 +0200
@@ -170,7 +170,6 @@
     neverDropUpdatedRows: true,
     useClientFiltering: false,
     useClientSorting: false,
-    criteriaPolicy: 'dropOnChange',
 
     // overridden to update the context/request properties for the fetch
     fetchRemoteData : function (serverCriteria, startRow, endRow) {
diff -r 5f39a1051539 -r da5f8acef63a 
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
  Wed Oct 26 13:37:44 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Wed Oct 26 15:02:48 2011 +0200
@@ -646,6 +646,14 @@
 // Allow searchs (with full dataset in memory/the datasource) not distinguish
 // between accent or non-accent words
 isc.DataSource.addProperties({
+  
+  // workaround for this issue:
+  // http://forums.smartclient.com/showthread.php?p=75186#post75186
+  // https://issues.openbravo.com/view.php?id=18841
+  compareAdvancedCriteria: function() {
+    return 1;
+  },
+  
   _fieldMatchesFilter: isc.DataSource.getPrototype().fieldMatchesFilter,
   fieldMatchesFilter: function(fieldValue, filterValue, requestProperties) {
     if (fieldValue && typeof fieldValue === 'string') {

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to