1. #1
    Ext User
    Join Date
    Jun 2010
    Posts
    1
    Vote Rating
    0
    wakeup is on a distinguished road

      0  

    Default Template syntax documentation?

    Template syntax documentation?


    Hey guys,
    Is there a way to not just include json field-variables in templates but also arbitrary JS?

    Example: {var t = Date.parse(t_start); t.hours + ":" + t.minutes;} instead of {t_start} in:
    Code:
    tpl: [
    	'<tpl for=".">',
    	  '<div class="track_list">',
    	    '<div class="track_start">{t_start}</div>',
    	    '<div class="track_performer">{performer}</div>',
    	    '-',
    	    '<div class="track_title">{name}</div>',
    	  '</div>',
    	'</tpl>'
          ]
    cheers,
    max

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    One way of adding custom formatting functions to your templates:
    Code:
    tpl: [
    	'<tpl for=".">',
    	  '<div class="track_list">',
    	    '<div class="track_start">{t_start:this.customFormat}</div>',
    	    '<div class="track_performer">{performer}</div>',
    	    '-',
    	    '<div class="track_title">{name}</div>',
    	  '</div>',
    	'</tpl>',
            {
                customFormat : function(value) {
                    var t = Date.parse(value);
                    return t.hours + ':' + t.minutes;
                }
            }
          ]
    However, we provide date formatting inside templates out of the box. You could specify your template as follows:
    Code:
    tpl: [
    	'<tpl for=".">',
    	  '<div class="track_list">',
    	    '<div class="track_start">{t_start:dateFormat("h:i")}</div>',
    	    '<div class="track_performer">{performer}</div>',
    	    '-',
    	    '<div class="track_title">{name}</div>',
    	  '</div>',
    	'</tpl>'
          ]

Similar Threads

  1. Ext.DomHelper.Template: one template, ten YUI grids
    By moraes in forum Community Discussion
    Replies: 11
    Last Post: 18 Dec 2012, 4:55 AM
  2. Ext.(X)Template complete documentation
    By aaaee8 in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 24 Feb 2009, 2:35 AM
  3. Linking code and syntax into documentation?
    By oldroy in forum Community Discussion
    Replies: 2
    Last Post: 14 Dec 2007, 6:27 PM
  4. Replies: 4
    Last Post: 20 Aug 2007, 9:18 AM

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."