PDA

View Full Version : textfield focus doesn't work in control?



janksen
27 Dec 2011, 8:24 AM
i have some textfields in my view file,such as:

items: [
{
xtype: 'textfield',
name: 'name',
itemId: 'txtName',
labelCls: 'input_label',
clearIcon: true
},
//other code

when i listen the txtName focus event in my controller file,it didn't work;

init: function() {
this.control({
'#txtName':
{
focus: this.onTxtNameFocus
}
})
}

onTxtNameFocus: function(txt, e, eOpts) {
alert('0'); //it didn't work
}

can someone tell me where i was wrong? ths.

mitchellsimoens
27 Dec 2011, 8:42 AM
you just specified an itemId without a parent in your selector

janksen
29 Dec 2011, 6:52 AM
it works,thank you very much.