Mad*_*ech 1 javascript extjs extjs4.2
我是Extjs的新手.我有场的形式.我需要为特定领域设定焦点.这是我正在使用的代码.
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();
}
Run Code Online (Sandbox Code Playgroud)
我有焦点的领域有数量.但我无法集中注意力.
任何人都可以帮忙吗?
另外,我尝试过使用 Ext.getCmp('quantityTFLme').focus(false, 200);
在触发焦点之前尝试延迟,
示例代码:
afterrender: function(field) {
Ext.defer(function() {
field.focus(true, 100);
}, 1);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3677 次 |
| 最近记录: |