details:   https://code.openbravo.com/erp/devel/pi/rev/c412dd9e950d
changeset: 34073:c412dd9e950d
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Mon May 28 09:03:30 2018 +0200
summary:   fixes bug 38582: wrong behavior after setting a date filter having 
lazy filtering

  The grid was not being set as ready to filter after setting a date filter 
using the date range dialog. Now, we explicitly put the grid in the correct 
status in that case.

  Together with this, a new function called getSourceGrid() has been added, 
which provides the reference to the parent (source) grid of the date filter. 
And we are using it where needed.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
 |  21 +++++++--
 1 files changed, 15 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r f07a2602ad23 -r c412dd9e950d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
       Fri May 25 11:56:48 2018 +0000
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
       Mon May 28 09:03:30 2018 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011-2017 Openbravo SLU
+ * All portions are Copyright (C) 2011-2018 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -453,9 +453,9 @@
   },
 
   getFieldCriterionFromGrid: function () {
-    var currentGridCriteria, fieldCriterion, criteria;
-    if (this.grid && this.grid.sourceWidget && 
this.grid.sourceWidget.getCriteria) {
-      currentGridCriteria = this.grid.sourceWidget.getCriteria();
+    var currentGridCriteria, fieldCriterion, criteria, sourceGrid = 
this.getSourceGrid();
+    if (sourceGrid && sourceGrid.getCriteria) {
+      currentGridCriteria = sourceGrid.getCriteria();
       if (currentGridCriteria) {
         criteria = currentGridCriteria.criteria || [];
         fieldCriterion = criteria.find('fieldName', this.getFieldName());
@@ -464,6 +464,10 @@
     return fieldCriterion;
   },
 
+  getSourceGrid: function () {
+    return this.grid && this.grid.sourceWidget;
+  },
+
   clearFilterValues: function () {
     this.singleDateValue = null;
     this.singleDateDisplayValue = '';
@@ -515,13 +519,18 @@
 
   rangeDialogCallback: function (value) {
     var data = value,
-        illegalStart = data && data.start && 
!this.isCorrectRangeValue(data.start);
-    var illegalEnd = data && data.end && !this.isCorrectRangeValue(data.end);
+        illegalStart = data && data.start && 
!this.isCorrectRangeValue(data.start),
+        illegalEnd = data && data.end && !this.isCorrectRangeValue(data.end),
+        sourceGrid = this.getSourceGrid();
     if (illegalStart || illegalEnd) {
       return;
     }
     this.singleDateMode = false;
     this.singleDateValue = null;
+    if (this.rangeItemValue !== value && sourceGrid && 
sourceGrid.lazyFiltering && sourceGrid.sorter) {
+      sourceGrid.filterHasChanged = true;
+      sourceGrid.sorter.enable();
+    }
     this.rangeItemValue = value;
     this.displayValue();
     this.form.grid.performAction();

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to