[Commom] Add focus method for input field, combobos, spinner components.

[SSE] Fix focus for data range fields
This commit is contained in:
Julia Radzhabova 2020-09-26 16:58:37 +03:00
parent 82ec0ba7a4
commit 35b2061855
8 changed files with 34 additions and 15 deletions

View file

@ -343,7 +343,7 @@ define([
Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl); Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
if (this.options.takeFocusOnClose) { if (this.options.takeFocusOnClose) {
var me = this; var me = this;
setTimeout(function(){me._input.focus();}, 1); setTimeout(function(){me.focus();}, 1);
} }
}, },
@ -677,6 +677,10 @@ define([
wheelSpeed: 10, wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
}, this.options.scroller)); }, this.options.scroller));
},
focus: function() {
this._input && this._input.focus();
} }
} }
})()); })());

View file

@ -300,7 +300,7 @@ define([
}, },
focus: function() { focus: function() {
this._input.focus(); this._input && this._input.focus();
}, },
checkValidate: function() { checkValidate: function() {

View file

@ -537,6 +537,10 @@ define([
v_out = parseFloat((v_out * 6.0 / 25.4).toFixed(6)); v_out = parseFloat((v_out * 6.0 / 25.4).toFixed(6));
return v_out; return v_out;
},
focus: function() {
if (this.$input) this.$input.focus();
} }
}); });

View file

@ -521,6 +521,9 @@ define([
handler: handlerDlg handler: handlerDlg
}).on('close', function() { }).on('close', function() {
panel.show(); panel.show();
_.delay(function(){
txtRange.focus();
},1);
}); });
var xy = panel.$window.offset(); var xy = panel.$window.offset();
@ -544,6 +547,9 @@ define([
panel.dataRangeTop = value; panel.dataRangeTop = value;
else else
panel.dataRangeLeft = value; panel.dataRangeLeft = value;
_.delay(function(){
txtRange.focus();
},1);
} }
}, },

View file

@ -239,7 +239,7 @@ define([
me.show(); me.show();
_.delay(function(){ _.delay(function(){
me._noApply = true; me._noApply = true;
input.cmpEl.find('input').focus(); input.focus();
me._noApply = false; me._noApply = false;
},1); },1);
}); });

View file

@ -169,15 +169,15 @@ define([
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);
var me = this;
_.delay(function(){
me.txtSourceRange.focus();
},50);
}, },
show: function() { show: function() {
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments); Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
var me = this;
_.delay(function(){
me.txtSourceRange.cmpEl.find('input').focus();
},50);
}, },
_setDefaults: function (props) { _setDefaults: function (props) {
@ -260,6 +260,9 @@ define([
handler: handlerDlg handler: handlerDlg
}).on('close', function() { }).on('close', function() {
me.show(); me.show();
_.delay(function(){
txtRange.focus();
},1);
}); });
var xy = me.$window.offset(); var xy = me.$window.offset();

View file

@ -215,7 +215,7 @@ define([
_.delay(function(){ _.delay(function(){
me._noApply = true; me._noApply = true;
me.args[0].argInput.cmpEl.find('input').focus(); me.args[0].argInput.focus();
me._noApply = false; me._noApply = false;
},100); },100);
} }
@ -367,7 +367,7 @@ define([
me.show(); me.show();
_.delay(function(){ _.delay(function(){
me._noApply = true; me._noApply = true;
input.cmpEl.find('input').focus(); input.focus();
me._noApply = false; me._noApply = false;
},1); },1);
}); });

View file

@ -184,15 +184,14 @@ define([
this.api.asc_registerCallback('asc_onLockDefNameManager', this.wrapEvents.onLockDefNameManager); this.api.asc_registerCallback('asc_onLockDefNameManager', this.wrapEvents.onLockDefNameManager);
this.api.asc_registerCallback('asc_onRefreshDefNameList', this.wrapEvents.onRefreshDefNameList); this.api.asc_registerCallback('asc_onRefreshDefNameList', this.wrapEvents.onRefreshDefNameList);
},
show: function() {
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
var me = this; var me = this;
_.delay(function(){ _.delay(function(){
me.inputName.cmpEl.find('input').focus(); me.inputName.cmpEl.find('input').focus();
},200); },200); },
show: function() {
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
}, },
_setDefaults: function (props) { _setDefaults: function (props) {
@ -231,6 +230,9 @@ define([
handler: handlerDlg handler: handlerDlg
}).on('close', function() { }).on('close', function() {
me.show(); me.show();
_.delay(function(){
me.txtDataRange.focus();
},1);
}); });
var xy = me.$window.offset(); var xy = me.$window.offset();