PDA

View Full Version : Can you find a Component by name?



UGA_Zimma
14 Dec 2009, 12:52 PM
I was curious if you could find a Component by name not id?

Field:


xtype:'textfield',
name:'testName',
id:'testId


This works great:


Ext.getCmp('testId')


I would like something for name:


Ext.getCmp('testName')


But this doesnt work.

Any thoughts?

Thanks,
UGA_Zimma

CrazyEnigma
14 Dec 2009, 7:50 PM
You can.

Because when you set up your configuration, you can set any property. Refer to the API (http://www.extjs.com/deploy/dev/docs/?class=Ext.Container) on this.


obj.find("name","testName");


You could also use itemId instead of id.