Call a function in an ExtJS XTemplate

Posted by Snowright on Stack Overflow See other posts from Stack Overflow or by Snowright
Published on 2010-04-10T00:55:43Z Indexed on 2010/04/10 1:03 UTC
Read the original article Hit count: 1365

Filed under:
|

I'm familiar with using a function to determine a specific condition using xtemplate but not sure how to directly call a function without the conditional if statement.

My code, for example, wants to append some characters to a string that I am using within my xtemplate. I think the best way to do it is append the characters when the xtemplate is rendered.

var myTpl = new Ext.XTemplate(
  '<tpl for=".">',

    '<tpl if="this.isThumbnailed(thumbnailed) == true">',

      '<img src=this.getThumbUrl(rawThumbUrl)/>', //this call to function does not work, also tried variations of this.

    '</tpl>',

  '</tpl>',

 {
  isThumbnailed : function(thumbnailed) {
    return ...;
  },
  getThumbUrl : function(rawThumbUrl) {
    //... //this function does not get called.
    return ...;
  }

 }
)

© Stack Overflow or respective owner

Related posts about extjs

Related posts about JavaScript