0

I can't get the following to work

{[displayDate(dateRelease);]} 

Each model from the store has the property "dateRelease"

I need to get that date and transform it with my displayDate() before displaying it.

When I write the code, I get the error that dateRelease is not found.

How should I proceed?

Fawar
  • 735
  • 2
  • 11
  • 32

2 Answers2

1

Try using values.dateRelease.

kevhender
  • 4,285
  • 1
  • 13
  • 16
  • Would you happen to know some kind of tutorial to understand what is going on in TPL, it kinds of bugs me how different it is from everything else. – Fawar Jul 10 '13 at 15:26
  • The docs have actually improved quite a bit on this, and offer a lot of good info: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.XTemplate. Other than that, most of the knowledge I've gained is from trial and error. :-/ – kevhender Jul 10 '13 at 15:30
  • I guess I should have known that the doc would not be Sencha touch's but ExtJS... They really don't care about their doc at all – Fawar Jul 10 '13 at 15:34
  • @Fawar, if this is for Touch you will also want to check their docs for XTemplate: http://docs.sencha.com/touch/2.2.1/#!/api/Ext.XTemplate. There are actually a few things missing from Touch that ExtJS has, like the for-each loops. – kevhender Jul 10 '13 at 15:41
  • I'm getting used to the "missing part", "missing doc", "wrong doc, wrong implementation", brag for a feature and end up unusuable XD – Fawar Jul 10 '13 at 15:43
0

See this question.

For your example it would look like:

itemTpl: new XTemplate(
    '<tpl>',
        '<p>{[this.displayDate(dateRelease)]}</p>',
    '</tpl>',
    {        
        displayDate: function(date){
            return runFunction(date);
        }
    }
);

I have not tested this syntax so there may be a typo.

Community
  • 1
  • 1
bwags
  • 998
  • 9
  • 16
  • I saw this thread, problem is using Sencha Architect, I may not write the 2nd part { displayDate : ....} has the field I get is put directly where your tags are :S – Fawar Jul 10 '13 at 15:34