admin管理员组文章数量:1326339
I am new to Extjs. I have form with field. I need to set focus for particular field. Here is the code I am using.
var priceTFLme = {
xtype: 'numberfield',
id:'priceLme',
fieldLabel: 'Price',
name: 'price',
value: bidOffer,
minValue: 0,
maxValue: 100,
allowDecimals: true,
decimalPrecision: 3,
step: 0.005,
vtype: 'natural'
};
var quantityTFLme = {
xtype: 'textfield',
id: 'quantityLme',
fieldLabel: 'Quantity',
value: '',
editable: true,
hasFocus: true,
vtype: 'natural',
listeners: {
afterrender: function(field) {
field.focus(false, 1000);
}
}
};
var formLME = new Ext.FormPanel({
labelWidth: 85,
frame:true,
id:'lmeHeaders',
bodyStyle:'padding:10px 10px 0',
defaults: {width: 225},
defaultType: 'textfield',
items: [quantityTFLme, priceTFLme ],
buttons: [{
id:'buyIdLME',
handler: function () {
}
}, {
id:'sellIdLME',
handler: function () {
}
}]
});
var winLme = Ext.widget('window', {
closeAction: 'close',
layout: 'fit',
resizable: false,
constrain: true,
modal: true,
items: formLME
});
function requestForLMEPrice() {
if (!winLme.rendered) {
winLme.render(Ext.getBody());
}
winLme.center();
winLme.show();
}
I have field to focus has Quantity. But i am unable to focus.
Can anyone help on this?
also, I have tried using Ext.getCmp('quantityTFLme').focus(false, 200);
I am new to Extjs. I have form with field. I need to set focus for particular field. Here is the code I am using.
var priceTFLme = {
xtype: 'numberfield',
id:'priceLme',
fieldLabel: 'Price',
name: 'price',
value: bidOffer,
minValue: 0,
maxValue: 100,
allowDecimals: true,
decimalPrecision: 3,
step: 0.005,
vtype: 'natural'
};
var quantityTFLme = {
xtype: 'textfield',
id: 'quantityLme',
fieldLabel: 'Quantity',
value: '',
editable: true,
hasFocus: true,
vtype: 'natural',
listeners: {
afterrender: function(field) {
field.focus(false, 1000);
}
}
};
var formLME = new Ext.FormPanel({
labelWidth: 85,
frame:true,
id:'lmeHeaders',
bodyStyle:'padding:10px 10px 0',
defaults: {width: 225},
defaultType: 'textfield',
items: [quantityTFLme, priceTFLme ],
buttons: [{
id:'buyIdLME',
handler: function () {
}
}, {
id:'sellIdLME',
handler: function () {
}
}]
});
var winLme = Ext.widget('window', {
closeAction: 'close',
layout: 'fit',
resizable: false,
constrain: true,
modal: true,
items: formLME
});
function requestForLMEPrice() {
if (!winLme.rendered) {
winLme.render(Ext.getBody());
}
winLme.center();
winLme.show();
}
I have field to focus has Quantity. But i am unable to focus.
Can anyone help on this?
also, I have tried using Ext.getCmp('quantityTFLme').focus(false, 200);
1 Answer
Reset to default 9Try defer before triggering focus,
sample code:
afterrender: function(field) {
Ext.defer(function() {
field.focus(true, 100);
}, 1);
}
本文标签: javascriptUnable to setFocus for Extjs textfieldStack Overflow
版权声明:本文标题:javascript - Unable to setFocus for Extjs textfield - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742200750a2431913.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论