Hybrid View

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    5
    Vote Rating
    0
    Miskah is on a distinguished road

      0  

    Default Unanswered: Ext Template for question

    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
    135
    Vote Rating
    7
    Answers
    11
    george.m is on a distinguished road

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

      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
    135
    Vote Rating
    7
    Answers
    11
    george.m is on a distinguished road

      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.

Thread Participants: 1