[DE] Form settings: don't add new list value on blur

This commit is contained in:
Julia Radzhabova 2020-12-24 16:25:49 +03:00
parent 6a34c61181
commit 5327fdd403

View file

@ -212,8 +212,8 @@ define([
value : '' value : ''
}); });
this.lockedControls.push(this.txtNewValue); this.lockedControls.push(this.txtNewValue);
this.txtNewValue.on('changed:after', this.onAddItem.bind(this));
this.txtNewValue.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.txtNewValue.on('inputleave', function(){ me.fireEvent('editcomplete', me);});
this.txtNewValue._input.on('keydown', _.bind(this.onNewValueKeydown, this));
this.list = new Common.UI.ListView({ this.list = new Common.UI.ListView({
el: $markup.findById('#form-list-list'), el: $markup.findById('#form-list-list'),
@ -457,6 +457,12 @@ define([
} }
}, },
onNewValueKeydown: function(event) {
if (this.api && !this._noApply && event.keyCode == Common.UI.Keys.RETURN) {
this.onAddItem();
}
},
onAddItem: function() { onAddItem: function() {
var store = this.list.store, var store = this.list.store,
value = this.txtNewValue.getValue(); value = this.txtNewValue.getValue();