Results 1 to 4 of 4

Thread: Ext Template for question

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default Unanswered: Ext Template for question

    Hi all,
    I wish display a key value in my JSON Object, there is a example
    {key} returns empty.


    My Ext Template :


    Code:
    <tpl for="kids">
        {key} : 
        <tpl for="kids.key">
            {name}
        </tpl>
    </tpl>





    My Json Object :
    Code:
    { 'kids' : { 'Boys' : { 'name': 'Georges' } } }

    I've tried everything, but i can't display the value {key} ( here, Boys ).
    I've looking in docs and post topics, but no solutions is available
    Any Help ?


    Regards

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    136
    Answers
    11
    Vote Rating
    7
      0  

    Default

    Wouldn't that just be {Boys} instead of {key} in your tpl?

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default

    My JSON Object is more complex, sometimes it's 'Boys' sometimes it's 'Girls'

    I need the key's dynamic value.

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    136
    Answers
    11
    Vote Rating
    7
      0  

    Default

    How the tpl works is that it tries to match whatever is in {...} (in the tpl) with the data object being passed to it, so you may have to define {Boys} and {Girls} in the tpl then.

Posting Permissions

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