Results 1 to 4 of 4

Thread: Duplicate IDs

  1. #1
    Sencha User
    Join Date
    Nov 2009
    Posts
    10

    Default Duplicate IDs

    I for one really miss the custom Google search for the forums
    Since I can't find anything after quite a while of searching, I thought I'd put the question out.

    What is the best way to place refs to deeply nested form field at the forefront of a panel component?
    I'm trying to avoid the complication and confusing '../../../../../../formField' situation.

    Alternatively, I'm using itemId on my fields, and finding a need to use find('itemId', 'formField') to grab the nested component. It's a bit nasty if you have a lot of find() lines.

    Should I be using id values on each of my components which are deeply nested, and then use findById()? If I have multiple instances of said nested panel, won't it cause confusion by having duplicate id values present? or is it only an issue if you use Ext.getCmp()?

    The documentation and examples I've seen weren't very clear, or didn't suggest an alternative for deeply nested components.

    Best,
    Jack

  2. #2
    Sencha User Screamy's Avatar
    Join Date
    Jun 2008
    Posts
    244

    Default

    I've been through exactly the same scenario as you and have come to the conclusion that using an "id" (and Ext.getCmp("someID")) on deeply nested object structures is the way to go. ID collisions are obviously an issue, but a little intelligent, reverse polish notation style naming usually takes care of that.

    I use "ref: ../objName" only if I need to move a child object reference up one level.

    Thx.

  3. #3
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Hardcoded IDs are not the best way.

    Accessing deeply nested items is not that easy right now, but there is a better way arriving in Ext 4 which is already part of the infrastructure which underpins Sencha Touch.


    http://dev.sencha.com/deploy/touch/d...r&member=query
    http://dev.sencha.com/deploy/touch/d...er&member=down
    http://dev.sencha.com/deploy/touch/d...r&member=child

    All built upon http://dev.sencha.com/deploy/touch/d...ComponentQuery

    This is like the familiar DOM querying and selection machinery we have all come to know and use.

    You will be able to reach down (or, hopefully, if they accept my suggestions, up into parent Containers) to find exactly the Component(s) you want.

  4. #4
    Sencha User
    Join Date
    Nov 2009
    Posts
    10

    Default

    Thanks very much to both of you for taking the time to help.

    It really sucks if you have FormPanel > Panel > Panel with columns > Field in column since it ends up being so deeply nested.

    One question - is the performance hit of Component > find() that high?

    Ext4 sounds great!

Similar Threads

  1. IDs conflict problem
    By syedarshadali in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 28 Oct 2009, 11:31 PM
  2. Replies: 2
    Last Post: 13 Nov 2007, 9:02 AM
  3. treenode ids
    By Barius in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 25 Oct 2007, 6:48 AM
  4. wildcard / multiple IDs
    By rmauser in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 20 May 2007, 12:44 PM

Posting Permissions

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