1. #1
    Sencha User TopKatz's Avatar
    Join Date
    Mar 2007
    Posts
    337
    Vote Rating
    2
    TopKatz is on a distinguished road

      0  

    Default XTemplate and Ext.os

    XTemplate and Ext.os


    Hello, Im trying to present a differnt xtempalte if a device is iOS. In EXTJS I would just build the tamplate in my initComponet. I'm using MVC pattern and define and that approach is nto working. So I was playing with trying to use a function in my template. This is what I ahve, but its nto wroking.

    Code:
    Ihc.mobile.ClientTPL = new Ext.XTemplate(
                                   
                                                   '<tpl if="this.checkOS() == \'ios\'">',
                                                        '<a href="http://maps.apple.com/q={address}+{city}+{state}+{zip}" target="_blank"><div id="clAddress">{address}</div>',
    
                                                    '<tpl else>',
                                                        '<a href="http://maps.google.com/maps?f=q&hl=en&geocode=&q={address}+{city}+{state}+{zip}" target="_blank"><div id="clAddress">{address}</div>',
                                                    '</tpl>',
                                                
                                      '</div>',
                                    {
                                    checkOS:function(){
                                        if(Ext.os.is.iOS){
                                            return 'ios';
                                        }else{
                                            return 'notios'
                                        }
    
                                        }
                                    }
                                )
    Everythign comes back as notios. Any hep of other ideas would be awesome!

  2. #2
    Sencha User TopKatz's Avatar
    Join Date
    Mar 2007
    Posts
    337
    Vote Rating
    2
    TopKatz is on a distinguished road

      1  

    Default


    This is working for those who want to know:

    Code:
    Ihc.mobile.ClientTPL = new Ext.XTemplate(
    
     '<tpl if="this.checkOS() == true">',
                                                        '<a href="http://maps.apple.com/?q={address}+{city}+{state}+{zip}" target="_blank"><div id="clAddress">{address}</div>',
    
                                                    '<tpl else>',
                                                        '<a href="http://maps.google.com/maps?f=q&hl=en&geocode=&q={address}+{city}+{state}+{zip}" target="_blank"><div id="clAddress">{address}</div>',
                                                    '</tpl>',
    {
                                    checkOS:function(){
    
                                            return Ext.os.is.iOS;
    
    
                                        }
                                    }

  3. #3
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,835
    Vote Rating
    125
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Thank you for posting your solution.

  4. #4
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Vote Rating
    99
    jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice jerome76 is just really nice

      0  

    Default


    Thanks TopKatz! I like this better than actually creating a whole separate XTemplate
    Sencha Touch 2.x
    Ext.ux.MultiBadgeButton - Forum | GitHub
    Ext.field.SmallRadio - Forum | GitHub

    Ext JS 4.x
    Ext Calendar Pro - Time Indicator - Forum| GitHub

Thread Participants: 2

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