1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    16
    Vote Rating
    0
    spbroom is on a distinguished road

      0  

    Default 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

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    97
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      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
    spbroom is on a distinguished road

      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
    97
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      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
    spbroom is on a distinguished road

      0  

    Default


    That's what I need. Thanks

Thread Participants: 1