PDA

View Full Version : problem with compositefield



maax
23 Apr 2010, 5:34 AM
Components in compositefield are not accessible through Ext.getCmp !!




xtype: 'compositefield',
fieldLabel: 'Pays',
items: [
{
id: 'comboCountry',
xtype: 'iconcombo',
hiddenName: 'country',
fieldLabel: 'Pays',
store: storeCountry,
hideTrigger:true,
valueField:'cou_id',
width: 150,
typeAhead: true,
forceSelection: true,
iconClsField: 'cou_flag',
displayField:'cou_name',
triggerAction: 'all',
selectOnFocus:true
},
{
xtype: 'button',
iconCls: Ext.ux.TDGi.iconMgr.getIcon('cross'),
text: 'Reset',
handler: function(){
alert("iiiii");

}
}]

}]




comboCountry is no longer accessible with Ext.getCmp('comboCountry').
error: comboCountry is undefined


Thanks for your help.

BR
Max

26 Apr 2010, 5:31 AM
Please refrain from posting duplicate threads. (deleted the 2nd one)

26 Apr 2010, 5:32 AM
1) *do not rely on Ext.getCmp to develop you applications!*
2) Are you sure that the composite field is actually rendered?

buergi
29 Apr 2010, 11:00 PM
1) *do not rely on Ext.getCmp to develop you applications!*

And what would be the correct way?

Mjollnir26
3 May 2010, 12:55 AM
I'd love to know that too.

I'm doing almost everything via lazy instantiation, so i have no variables which hold references to the components...
What should i use instead of Ext.getCmp()?

Plus, do you care to elaborate on why Ext.getCmp() is a bad idea?