Results 1 to 2 of 2

Thread: XTemplate variables

  1. #1
    Sencha Premium User
    Join Date
    May 2012

    Default XTemplate variables

    I am working with search results returned from an Endeca search engine. I created many xtemplates to handle the display for each record and one xtemplate that determines which subtemplate to apply. This is working fine, but I need to know how to store values that I will need further down in the template. A good example is "search terms" that I will need to use to highlight later in the process. I know I can create member functions to further process values, but when should I set the value?

    terms: '',
    setTerms: function(values) {
    this.terms = values.terms;
    getTerms: function() {
    return this.terms;

    1) Do I set via calls at the beginning of the template?

    <tpl if="">
    [{ this.setTerms(values) }]

    The problem I experienced with this is that the value was always one search behind. My second search would produce terms from my first search.

    2) Do I set from within my controller prior to calling the template?


    3) Do I just tack on to the data that I pass the template during apply? If so, when I am in the weeds of the search results "tpl for" loop, how do I get way back up to the terms value at the root in the JSON? I say there was a parent, but can I chain that all the way back up?

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    It sounds like instead of working around the issues you are having you need to rethink how you are doing things.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:

    Posts are my own, not any current, past or future employer's.

Posting Permissions

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