How to call functions within a XTemplate (itemTpl)

前端 未结 3 1165
再見小時候
再見小時候 2020-12-31 07:22

I would like to use Ext\'s String method on some text that will be output to the view.

For example:

itemTpl: [
    ...
    \'

        
3条回答
  •  -上瘾入骨i
    2020-12-31 08:01

    Note: The example below does not work as expected! Look at zelexir answer for clarification!

    You can use memberfunctions

    itemTpl: [
        ...
        '',
        '',
            '

    {post_text_teaser}

    ', '

    {timestamp}

    ', '', '

    {[this.doAction(post_text_teaser)]}

    ', ..., { // XTemplate configuration: disableFormats: true, // member functions: doAction: function(name){ return Ext.String.ellipsis(name + "\", 4); } } ]

提交回复
热议问题