changeset 105f17a36c5c in sao:default
details: https://hg.tryton.org/sao?cmd=changeset&node=105f17a36c5c
description:
        Trigger explicitly change event when setting value

        The value set by mousetrap callback in the date input must trigger the 
change
        event such that the value is actually set to the record field.

        issue10578
        review367281002
diffstat:

 src/view/form.js |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 0690b9561ef9 -r 105f17a36c5c src/view/form.js
--- a/src/view/form.js  Wed Jul 21 23:59:00 2021 +0200
+++ b/src/view/form.js  Thu Jul 22 00:00:08 2021 +0200
@@ -1658,7 +1658,8 @@
             mousetrap.bind('=', function(e, combo) {
                 if (!this.date.prop('readonly')) {
                     e.preventDefault();
-                    this.date.val(this._format(this.get_format(), moment()));
+                    this.date.val(this._format(this.get_format(), moment()))
+                        .change();
                 }
             }.bind(this));
 
@@ -1670,7 +1671,8 @@
                     e.preventDefault();
                     var date = this.get_value() || Sao.DateTime();
                     date.add(operator[1]);
-                    this.date.val(this._format(this.get_format(), date));
+                    this.date.val(this._format(this.get_format(), date))
+                        .change();
                 }.bind(this));
             }.bind(this));
         },
@@ -5021,11 +5023,11 @@
             mousetrap.bind('enter', function(e, combo) {
                 var value = this._parse(this.format, this.input.val());
                 value = this._format(this.format, value);
-                this.input.val(value);
+                this.input.val(value).change();
             }.bind(this));
             mousetrap.bind('=', function(e, combo) {
                 e.preventDefault();
-                this.input.val(this._format(this.format, moment()));
+                this.input.val(this._format(this.format, moment())).change();
             }.bind(this));
 
             Sao.common.DATE_OPERATORS.forEach(function(operator) {
@@ -5033,7 +5035,7 @@
                     e.preventDefault();
                     var date = this.get_value() || Sao.DateTime();
                     date.add(operator[1]);
-                    this.input.val(this._format(this.format, date));
+                    this.input.val(this._format(this.format, date)).change();
                 }.bind(this));
             }.bind(this));
         },

Reply via email to