1. #1
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default ext.template: possible to use a render-function outside the template-object?

    ext.template: possible to use a render-function outside the template-object?


    hi together,

    i am missing something like a scope for templates.

    i would like to do:

    [CODE]
    var countryTpl = new Ext.Template(
    '<div class="x-combo-list-item"><img style="width:16px; height:11px;" src="images/flags/{s}.png">&nbsp;&nbsp;{n:this.specialChars}</div>'
    );

    countryTpl.specialChars = function(value) {
    value = value.replace("

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    or to put it more general:

    is it possible to use a render-function, that is not directly bound to the template itself?

    like

    Code:
    var stateTpl = new Ext.Template(
            '<div class="x-combo-list-item">{n:stringModifiers.replaceSpecialChars}</div>'
        );

    i hope, someone has an idea.

    kind regards, tobiu

  3. #3
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    ok, i looked into the code:

    Code:
    compile : function(){
            var fm = Ext.util.Format;
            var useF = this.disableFormats !== true;
            var sep = Ext.isGecko ? "+" : ",";
            var fn = function(m, name, format, args){
                if(format && useF){
                    args = args ? ',' + args : "";
                    if(format.substr(0, 5) != "this."){
                        format = "fm." + format + '(';
                    }else{
                        format = 'this.call("'+ format.substr(5) + '", ';
                        args = ", values";
                    }...
    so it seems not possible to add a scope or call a method of another object directly.

    i build this workaround then:

    Code:
    var stateTpl = new Ext.Template('<div class="x-combo-list-item">{n:this.specialChars}</div>');
    
    stateTpl.specialChars = function(value) {
        return stringModifiers.replaceSpecialChars(value);
    }

  4. #4
    Ext User matjaz's Avatar
    Join Date
    Apr 2007
    Location
    Slovenia
    Posts
    126
    Vote Rating
    0
    matjaz is on a distinguished road

      0  

    Default


    even better:
    stateTpl.specialChars = stringModifiers.replaceSpecialChars;
    Regards,
    M.

  5. #5
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    hi matjaz,

    this point goes to you =)

    i thought about something like

    Code:
    Ext.util.Format.override({
        replaceSpecialChars...
    but i prefer having these functions in a seperate "class".


    thx, tobiu

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..." hd porno faketaxi