【发布时间】:2011-02-06 09:31:30
【问题描述】:
我熟悉使用函数来确定使用 xtemplate 的特定条件,但不知道如何在没有条件 if 语句的情况下直接调用函数。
例如,我的代码想要将一些字符附加到我在 xtemplate 中使用的字符串。我认为最好的方法是在渲染 xtemplate 时附加字符。
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 ...;
}
}
)
【问题讨论】:
标签: javascript extjs