1. #1
    Ext JS Premium Member
    Join Date
    Nov 2010
    Location
    Columbia, MD, USA
    Posts
    147
    Vote Rating
    0
    msmolyak is on a distinguished road

      0  

    Default Referencing child components in ExtJS 4

    Referencing child components in ExtJS 4


    ExtJS 3 introduced a 'ref' attribute allowing the code to refer to the child components (nested at any level) of a given component using simple dot notation.

    I am trying migrate the ExtJS 3 code that uses this technique to ExtJS 4 and getting errors stating that the child component is not defined. I checked the API documentation and was not able to find any trace of 'ref' attribute.

    What happened to it? What is the proper way of referencing child components in ExtJS 4?

    Michael

  2. #2

  3. #3
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      1  

    Default


    ref was removed in Ext 4? Why?
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  4. #4
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      1  

    Default


    Ref has limitations that proper component query usage overcomes.

  5. #5
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      6  

    Default


    ??

    The ref functionality should have been kept. However, it should have been modified to use component selectors/query instead of it's own syntax.

    I put ref in the framework for a purpose, to automate the process of looking up child components, instead of manually querying. "proper component query usage" doesn't address or apply to that at all. Why would anyone want to write a whole line of query code to get a reference that could have been automatic. In a real app, ref can save you 100s of lines of code. I used it religiously in every app I wrote with Ext 3.
    Jack Slocum
    Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum
    jack@extjs.com

  6. #6
    Sencha Premium Member ethraza's Avatar
    Join Date
    Jun 2007
    Location
    Brazil
    Posts
    362
    Vote Rating
    3
    ethraza is on a distinguished road

      0  

    Default ref:'../back/please'

    ref:'../back/please'


    The greatest pain migrating ExtJs3 to 4 is been this, for me.

    First time I saw this ref stuff in ExtJs3, it looked so amazing to simplify the access of deep nested items that I heavly used it.

    There is some way, some plugin, some class, don't know, that bring ExtJs3 ref back?
    Somebody have "up ported" it to Extjs4?

    Thanks

    ------------
    Now I saw that is Mr. Slocum just before me talking! Now I see why ExtJs 4 is been so odd.
    Last edited by ethraza; 16 Oct 2013 at 11:38 AM. Reason: outflow
    LAMPE (Linux / Apache / MySQL / PHP / ExtJs)

  7. #7
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    123
    Vote Rating
    0
    BuckBazooka is on a distinguished road

      0  

    Default


    Great. None of the links that Animal is suggesting are working. :-(

  8. #8
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    418
    Vote Rating
    61
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    Quote Originally Posted by BuckBazooka View Post
    Great. None of the links that Animal is suggesting are working. :-(
    Their locations changed slightly. Try these:

    http://docs.sencha.com/extjs/4.0.0/#...ComponentQuery

    http://docs.sencha.com/extjs/4.0.0/#...r-method-query

    http://docs.sencha.com/extjs/4.0.0/#...r-method-child

    http://docs.sencha.com/extjs/4.0.0/#...er-method-down

  9. #9
    Sencha User
    Join Date
    Jul 2014
    Posts
    9
    Vote Rating
    0
    mangeshppatil is on a distinguished road

      0  

    Default


    if component id not singleton how can we get reference for it ....i am not able to assigne id so cant use this option for comboxes i am using

Similar Threads

  1. Referencing components
    By jschwartzbeck in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 1 Nov 2010, 10:07 AM
  2. Referencing components in containers
    By dlipski in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 13 Nov 2009, 7:41 AM
  3. Replies: 2
    Last Post: 7 Aug 2009, 4:46 PM
  4. Referencing body of a child item when extending a container
    By elishnevsky in forum Ext 3.x: Help & Discussion
    Replies: 8
    Last Post: 6 Aug 2009, 12:08 PM

Thread Participants: 7

Tags for this Thread