Results 1 to 5 of 5

Thread: Accessing nested items in a form

  1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    16
    Vote Rating
    0
      0  

    Default 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

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    For FormPanels you can use:
    Code:
    var field = formPanel.getForm().findField('idOrNameOfField');
    (but this only works if the field is already rendered)

  3. #3
    Ext User
    Join Date
    Jan 2009
    Posts
    16
    Vote Rating
    0
      0  

    Default

    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

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    For other components you either:
    1. Use itemIds, e.g.
    Code:
    var fieldset = container.getComponent('itemIdOfTabPanel')
      .getComponent('itemIdOfPanel')
      .getComponent('itemIdOfFieldset');
    (drawback: you have to know the container structure at runtime)
    2. Use ids, e.g.
    Code:
    var fieldset = Ext.getCmp('idOfFieldset');
    (drawback: ids need to be unique throughout the page)
    3. Use ref (Ext 3 only), e.g.
    Code:
    {xtype: 'fieldset', ref: '///myfieldset'}
    ...
    var fieldset = container.myfieldset;
    (drawback: you have to know the container structure at designtime)

  5. #5
    Ext User
    Join Date
    Jan 2009
    Posts
    16
    Vote Rating
    0
      0  

    Default

    That's what I need. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •