changeset cc0735afe0d6 in sao:6.0
details: https://hg.tryton.org/sao?cmd=changeset&node=cc0735afe0d6
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
(grafted from 105f17a36c5cf22e2a6acdc389115cb25298e7e5)
diffstat:
src/view/form.js | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diffs (46 lines):
diff -r 602c0d35425b -r cc0735afe0d6 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
@@ -1649,7 +1649,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));
@@ -1661,7 +1662,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));
},
@@ -5012,11 +5014,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) {
@@ -5024,7 +5026,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));
},