Results 1 to 2 of 2

Thread: Can you assign a variable in XTemplate?

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default Can you assign a variable in XTemplate?

    So I want to create a format like this in my XTemplate:
    Football
    * 49ers
    * Saints
    BaseBall
    * Giants
    * Mets
    * Cardinals

    My data structure is
    [
    {
    type:'Football',
    name:'49ers'
    },
    {
    type:'Football',
    name:'Saints'
    },
    {
    type:'BaseBall',
    name:'Giants'
    }
    ]

    One way to create the format above is to set a variable in XTemplate and check to see if it's changed so the header (Football, Baseball) changed.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,695
    Answers
    3944
    Vote Rating
    1279
      0  

    Default

    In the <tpl> you could do something like this.type = values.type, this will be the scope of the template.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

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