fixes issue 31904: 'Filter on change' option set to N does not work
authorCarlos Aristu <carlos.aristu@openbravo.com>
Tue, 19 Jan 2016 08:50:03 +0100
changeset 28266 a4e7ab3c00b3
parent 28265 1e99517ffbe9
child 28267 d4762042e1ad
child 28537 9bcad8c551f0
fixes issue 31904: 'Filter on change' option set to N does not work

The text items were not accessing properly to the 'filter on change' property. For P&E grids an additional problem was happening: the value of a variable called actOnKeypress used to disable/enbale the filtering on change was being overriden by the evaluateDisplayLogicForGridColumns() function. Also, the filter when pressing enter was not being working neither because the editFormDefaults values were not being used properly in P&E.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-text.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-text.js	Tue Jan 19 07:54:44 2016 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-text.js	Tue Jan 19 08:50:03 2016 +0100
@@ -128,8 +128,12 @@
 
   init: function () {
     var field = this.grid.getField(this.name);
-    if (field && field.gridProps && field.gridProps.filterOnChange === false) {
+    if (field && field.gridProps && field.gridProps.filterEditorProperties && field.gridProps.filterEditorProperties.filterOnChange === false) {
       this.actOnKeypress = false;
+      // Explicitly sets the filterOnKeypress property of the field.
+      // This prevents the restoring of this.actOnKeypress to true when it should remain false.
+      // See issue https://issues.openbravo.com/view.php?id=31904
+      field.filterOnKeypress = false;
     }
     this.Super('init', arguments);
   },
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js	Tue Jan 19 07:54:44 2016 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js	Tue Jan 19 08:50:03 2016 +0100
@@ -81,7 +81,7 @@
 
     // the getValuesAsCriteria function of the edit form of the filter editor should always be called with 
     // advanced = true to guarantee that the returned criteria will have the proper format
-    this.filterEditorDefaults.editFormDefaults = this.filterEditorDefaults.editFormDefaults || {};
+    this.filterEditorDefaults.editFormDefaults = this.editFormDefaults || {};
     this.filterEditorDefaults.editFormDefaults.originalGetValuesAsCriteria = isc.DynamicForm.getPrototype().getValuesAsCriteria;
     this.filterEditorDefaults.editFormDefaults.getValuesAsCriteria = function (advanced, textMatchStyle, returnNulls) {
       var useAdvancedCriteria = true;