1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    19
    Vote Rating
    2
    WendyLG is on a distinguished road

      0  

    Default display fields, tpl and formats

    display fields, tpl and formats


    I am trying to format a value in a display field to be a clickable telephone number. it all seems to work fine the very first time this form is displayed.
    But when a new model is loaded and the form redisplays all of my anchor tags and icons just disappear and the phone number is just displayed as a plain old number.

    Code:
    /*global Ext,Coda,U4*/
    
    Ext.util.Format.url = function(value) {
        var url = U4.util.Path.encodeSegments(Coda.telephoneUrlFormat, {
            number: value.replace(/ /g,'')
        });
        
        var imagePath,
            iconTag,
            classTag;
    
        if(Ext.isEmpty(value)){
            return "";
        }
        else {
            imagePath = Coda.imagePath + 'icon/phone.png';
            iconTag = '<IMG SRC=\"'+ imagePath+'\">';
            classTag = 'class="'+Coda.baseCSSPrefix+'link-anchor"';
            return '<A href=\"' + url + '\" ' + classTag + '>'+iconTag + Ext.htmlEncode(value) + '</A>';
        }
    };
    /**
     * A display field which formats values using a Coda Type.
     */
    Ext.define('Coda.form.field.LinkDisplay', {
        extend : 'Coda.form.field.Display',
        alias : 'widget.coda_linkfield',
        requires : ['Coda.web.Types'],
    
        fieldSubTpl: [
                      '<div id="{id}"',
                      '<tpl if="fieldStyle"> style="{fieldStyle}"</tpl>',
                      ' class="{fieldCls}">{value:url}</div>',
                      {
                          compiled: true,
                          disableFormats: false
                          
                      }
                  ]
    
       
    });
    .

    I have done some digging and it is this method from 'Ext.form.field.Display' that does the splatting.
    Why isn't my tpl ever looked at again? (had a break point in the format method)

    Code:
    setRawValue: function(value) {
            var me = this,
                display;
    
            value = Ext.value(value, '');
            me.rawValue = value;
            if (me.rendered) {
                me.inputEl.dom.innerHTML = me.getDisplayValue(); <-- this line here
    
            }
            return value;
        },
    

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
    slinky2000 is on a distinguished road

      0  

    Default


    It's funny, I'm looking at exactly the same problem today. I create a tpl for a display field and when the values are updated the tpl gets ignored.

    Code:
    {
        xtype: 'form',
        items:[{
            xtype: 'displayfield'
            fieldLabel: 'Date',
            tpl: new Ext.XTemplate('{timestamp:parseTimestampAndFormat}')    
        }]
    }
    Code:
    form.setValues({"timestamp": 1326448100000})
    I've my own custom util function parseTimestampAndFormat

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    19
    Vote Rating
    2
    WendyLG is on a distinguished road

      0  

    Default


    I ended up overwriting getDisplayValue, and making that return my html.

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    2
    Vote Rating
    0
    slinky2000 is on a distinguished road

      0  

    Default


    Yea I ended up overwriting 'setRawValue' and making my own component xtype

Thread Participants: 1

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..."