-
11 May 2009 3:36 AM #1
Accessing nested items in a form
Accessing nested items in a form
Hi, a quick question:
I have a formPanel that's fairly complex in terms of layout, lots of nested columns tabs etc.
I am using a factory to return different instances of the form to use in different situations and I want occasionaly to change the title of a tab.
On simpler forms if I wanted to accessthe items within the form I just used the formPanel.items property and worked from there. Is there an easy way to reference an item that is more deeply nested?
Thanks for the help.
Stuart
-
11 May 2009 3:38 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
For FormPanels you can use:
(but this only works if the field is already rendered)Code:var field = formPanel.getForm().findField('idOrNameOfField');
-
11 May 2009 4:29 AM #3
Thanks, that works great for actual fields in the form. But what about something like a tab title, can I do something similar for that?
Cheers for the help
-
11 May 2009 4:40 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
For other components you either:
1. Use itemIds, e.g.
(drawback: you have to know the container structure at runtime)Code:var fieldset = container.getComponent('itemIdOfTabPanel') .getComponent('itemIdOfPanel') .getComponent('itemIdOfFieldset');
2. Use ids, e.g.
(drawback: ids need to be unique throughout the page)Code:var fieldset = Ext.getCmp('idOfFieldset');
3. Use ref (Ext 3 only), e.g.
(drawback: you have to know the container structure at designtime)Code:{xtype: 'fieldset', ref: '///myfieldset'} ... var fieldset = container.myfieldset;
-
11 May 2009 5:31 AM #5


Reply With Quote