1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    418
    Vote Rating
    0
    pokerking400 is on a distinguished road

      0  

    Default [SOLVED] : if else in Ext.XTemplate

    [SOLVED] : if else in Ext.XTemplate


    Hi,

    I am trying to show different thumbnail for video and images.

    Now there is some syntax error. Can someone help with this?.

    Thanks.

    Code:
     myexpander= new Ext.grid.RowExpander({
    tpl: new Ext.XTemplate(
    '<p>',															'<tpl if="mediatype==image">',
    '<p><img src="'+Ext.webhost+'/media/{property}/images/{medianame_file}" width="100" height="75"  ></p>',
    '</tpl>',
    '<tpl if="mediatype==video">',
    '<p><img src="'+Ext.webhost+'/media/video.jpg" width="100" height="75"  ></p>',
    '</tpl>',
    '</p>'
    )
    });
    Image and video are strings. mediatype is column value

    I think it is problem of comparing to string. It is assuming video and image as column.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,499
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    It needs quotes, otherwise it's gonig to compare it to the image property rather than the string "image".

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    418
    Vote Rating
    0
    pokerking400 is on a distinguished road

      0  

    Default


    Still nothing!. No error though. Just blank except the filename text i added last to indicate everything works except template if else.

    Code:
    myexpander= new Ext.grid.RowExpander({
    tpl: new Ext.XTemplate(
    '<p>',
    '<tpl if="mediatype=='+"'image'"+'">',
    '<p><img src="'+Ext.webhost+'/media/{property}/images/{medianame_file}" width="100" height="75"  ></p>',
    '</tpl>',
    '<tpl if="mediatype=='+"'video'"+'">',
    '<p><img src="'+Ext.webhost+'/media/video.jpg" width="100" height="75"  ></p>',
    '</tpl>',
    '</p>',
    '<p>{medianame_file}</p>'
    });

  4. #4
    Ext User
    Join Date
    Apr 2008
    Posts
    418
    Vote Rating
    0
    pokerking400 is on a distinguished road

      0  

    Default


    Infact it works. mediatype is combo box. I need to compare with combobox values not the display value.

    Here is the image of my grid.


  5. #5
    Ext User
    Join Date
    Apr 2008
    Posts
    418
    Vote Rating
    0
    pokerking400 is on a distinguished road

      0  

    Default


    close this.

  6. #6
    Sencha User
    Join Date
    Feb 2013
    Posts
    1
    Vote Rating
    1
    Kimi05 is on a distinguished road

      1  

    Default


    see if these examples help


    '<tpl if="id == \'download\'">...</tpl>',
    "<tpl if='name == \"Don\"'>Hello</tpl>"

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