details:   https://code.openbravo.com/erp/devel/pi/rev/330cd48c5a70
changeset: 28712:330cd48c5a70
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Tue Mar 15 19:12:36 2016 +0100
summary:   fixes issue 32474: [object Object] appears after clearing value in 
selector

Having singleDateMode as false after clearing the filter content of the date 
causes the return of an empty object in the getValuesAsCriteria method of the 
grid. The this.singleDateMode was being set to true in clearFilterValues 
function, but this statement was deleted to solve issue 31705, because it was 
preventing to show the range dialog after clearing the filters, when pressing 
the Enter key.

To solve both problems the change regarding setting singleDateMode in 
clearFilterValues has been reverted, and in order to ensure that the range 
dialog is displayed when it should be, a new check has been included in the 
keyPress method.

diffstat:

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

diffs (28 lines):

diff -r 8d0b0cebab04 -r 330cd48c5a70 
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
       Mon Mar 14 10:42:09 2016 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
       Tue Mar 15 19:12:36 2016 +0100
@@ -459,6 +459,7 @@
   clearFilterValues: function () {
     this.singleDateValue = null;
     this.singleDateDisplayValue = '';
+    this.singleDateMode = true;
     this.rangeItemValue = null;
     this.rangeItem.setValue(null);
     this.setElementValue('', '');
@@ -725,11 +726,15 @@
   },
 
   keyPress: function (item, form, keyName, characterValue) {
+    var enterOnEmptyItem;
     if (keyName === 'Enter') {
       if (this.singleDateMode) {
+        enterOnEmptyItem = !item.getValue() && !item.getEnteredValue();
         this.expandSingleValue();
         this.form.grid.performAction();
-        return false;
+        if (!enterOnEmptyItem) {
+          return false;
+        }
       }
       this.showRangeDialog();
       return false;

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to