details:   https://code.openbravo.com/erp/devel/pi/rev/dc77ef58d97c
changeset: 13769:dc77ef58d97c
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Tue Sep 13 13:35:15 2011 +0200
summary:   Make application a bit more robust, prevent jscript error when 
reloading the complete app

details:   https://code.openbravo.com/erp/devel/pi/rev/a5546358a8a2
changeset: 13770:a5546358a8a2
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Tue Sep 13 13:38:19 2011 +0200
summary:   Fixes issue 18509: FIlter expressions are automatically removed when 
typing
Prevent filtering when only an operator is entered

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
    |  29 ++++++++++
 
modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
 |   7 +-
 2 files changed, 34 insertions(+), 2 deletions(-)

diffs (58 lines):

diff -r d488d55f07d4 -r a5546358a8a2 
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
  Tue Sep 13 13:28:10 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
  Tue Sep 13 13:38:19 2011 +0200
@@ -241,6 +241,35 @@
         }
         return ret;
       },
+
+      // overridden for:
+      // https://issues.openbravo.com/view.php?id=18509
+      editorChanged : function (item) {
+        var prop, same, opDefs, val = item.getElementValue(); 
+          actOnKeypress = item.actOnKeypress === true ? item.actOnKeypress : 
this.actOnKeypress;                           
+        if (this.sourceWidget.allowFilterExpressions && val && actOnKeypress) {
+          // now check if the item element value is only
+          // an operator, if so, go away
+          opDefs = isc.DataSource.getSearchOperators();
+          for (prop in opDefs) {
+            if (opDefs.hasOwnProperty(prop)) {
+
+              // let null and not null fall through
+              // as they should be filtered
+              if (prop === 'isNull' || prop === 'notNull') {
+                continue;
+              }
+              
+              same = opDefs[prop].symbol && 
+                (opDefs[prop].symbol === val || 
opDefs[prop].symbol.startsWith(val));
+              if (same) {
+                return;
+              }
+            }
+          }
+        }
+        return this.Super('editorChanged', arguments);
+      },
       
       // repair that filter criteria on fk fields can be 
       // on the identifier instead of the field itself.
diff -r d488d55f07d4 -r a5546358a8a2 
modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
--- 
a/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
       Tue Sep 13 13:28:10 2011 +0200
+++ 
b/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js
       Tue Sep 13 13:38:19 2011 +0200
@@ -316,10 +316,13 @@
       requestProperties.params = 
this.getFetchRequestParams(requestProperties.params);
 
       requestProperties.params.showAll = true;
-      this.dataSource.fetchData(criteria, function(dsResponse, data, 
dsRequest){
+      // sometimes we get here before the datasource
+      // is set
+      if (this.dataSource) {
+        this.dataSource.fetchData(criteria, function(dsResponse, data, 
dsRequest){
           
dsResponse.clientContext.grid.widget.setTotalRows(dsResponse.totalRows);
         }, requestProperties );
-
+      }
     } else {
       this.widget.setTotalRows(dsResponse.totalRows);
     }

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to