Results 1 to 3 of 3

Thread: Access to XTemplate parent when nested?

  1. #1
    Sencha User
    Join Date
    Oct 2008
    Posts
    13

    Default Access to XTemplate parent when nested?

    How can I access a parent when I am nested?

    Code:
    '<tpl if="contentType == \'DayPlanner\'">',                         
        'parent id works right here: {parent.id}',
        '<tpl for="day">',
            'parent id fails here, how do we access it? {parent.id}',
            // tried {parent.parent.id}, that doesn't work.
    Any tips or workarounds?

  2. #2
    Sencha User
    Join Date
    Oct 2008
    Posts
    13

    Default

    I did search on this topic before I posted, but not until after I posted did I see Condor's answer to a similar post. http://www.sencha.com/forum/showthre...o-nested-loops

    The magic is the secret command:

    '<tpl exec="values.parent = parent;"></tpl>'

    This exec REALLY ought to be mentioned in the XTemplate documentation.

  3. #3
    Sencha User
    Join Date
    Dec 2007
    Posts
    69

    Default

    You saved my day !

    +1 for the documentation update ...

Similar Threads

  1. Replies: 5
    Last Post: 3 Mar 2014, 10:40 AM
  2. Access parent in handler
    By wuschba in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 12 Aug 2008, 10:20 AM
  3. Replies: 4
    Last Post: 15 Apr 2008, 7:25 AM
  4. Unable to access Nested DIV in Nested Layout
    By mwh154 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 9 Jan 2008, 1:09 PM
  5. Why no access to parent configs?!
    By steve.neill in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 25 Sep 2007, 12:26 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
  •