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)

--HG--
branch : 6.0
This commit is contained in:
Cédric Krier committed 2021-07-22 00:00:08 +02:00
1 parent 5883d40a9e
commit 57f03f2a53
1 file changed
+7 -5
+7 -5
View File
@@ -1649,7 +1649,8 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
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 @@ function eval_pyson(value){
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));
},