How to call functions within a XTemplate (itemTpl)
问题 I would like to use Ext's String method on some text that will be output to the view. For example: itemTpl: [ ... '<tpl switch="post_type">', '<tpl case="new_user">', '<p>{post_text_teaser}</p>', '<p>{timestamp}</p>', '<tpl default>', '<p>' + Ext.String.ellipsis( + '{post_text_teaser}' + \, 4) + '</p>', ... ].join(''), but of course the concatenation in line 10 is illegal. Do you know if it's possible or how to do this correctly? 回答1: This should solve your problem: '<tpl switch="post_type">'