PDA

View Full Version : How to concatenate an Ext.JS method inside a tpl string?



imcl
25 Sep 2012, 12:42 PM
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?

haduki
25 Sep 2012, 5:21 PM
itemTpl: [
...
'<tpl switch="post_type">',
'<tpl case="new_user">',
'<p>{post_text_teaser}</p>',
'<p>{timestamp}</p>',
'<tpl default>',
'<p>{[Ext.String.ellipsis(values.post_text_teaser,4)]}</p>',
...
].join(''),

pls,get more info from ext doc.