I am using two tabpanels (for e.g T1 and T2). Their are two textfields and submit button in T2 as shown:
xtype: 'form',
title: 'Search',
id:'searchref',
items: [
{
xtype: 'textfield',
fieldLabel: 'reference1',
id:'reference1',
enableKeyEvents:true,
listeners:{
keyup:function(){
Ext.getCmp('Submit').enable();
Ext.getCmp('reference2').disable();
if(Ext.getCmp('reference1').getValue() == "" )
{
Ext.getCmp('Submit').disable();
Ext.getCmp('reference2').enable();
}
}
}
},
{
xtype: 'textfield',
fieldLabel: 'reference2',
id:'reference2',
enableKeyEvents:true,
listeners:{
keyup:function(){
Ext.getCmp('Submit').enable();
Ext.getCmp('reference1').disable();
if(Ext.getCmp('reference2').getValue() == "" )
{
Ext.getCmp('Submit').disable();
Ext.getCmp('reference1').enable();
}
}
}
},
{
xtype: 'button',
text: 'Submit',
disabled:true,
id:'Submit',
}
]
In my T1, I am trying to do as shown:
Ext.getCmp('tabpanel').setActiveTab(1);
Ext.getCmp('reference1').setValue(RefNo);
MY PROBLEM:
The keyup event listener not getting fired on setting the value of textfield from T1
Please help me resolve this.
Any help is appreciated. Thanks.
you should use change event instead of keyup
I'm posting this for historical reasons. Maybe it will come in handy for developers working on legacy Extjs3 (I'm still writing code for Extjs 3.4).
To enable keyup
and keypress
events on textfiels, add enableKeyEvents
xtype: 'textfield',
enableKeyEvents: true,
By default:
keypress( this, e )
Keypress input field event. This event only fires if enableKeyEvents is set to true.
and
keyup( this, e )
Keyup input field event. This event only fires if enableKeyEvents is set to true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With