Hybrid View

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    118
    Answers
    11
    Vote Rating
    4
    Sasha172 is on a distinguished road

      1  

    Default Unanswered: XTemplate TPL IF not working :(

    Unanswered: XTemplate TPL IF not working :(


    Hi,
    So I know that this seems like a bit of a noob question but its really really not working !! I've tried everything.

    My XTemplate Code
    Code:
    remtable = new Ext.XTemplate(
    "<tpl if='status ==  1'>",
          "<table border=0><tr><td><font size=4><b>{time}</b></font><br><font size=3 color='gray'>",
    "<tpl if='valid == 1'>Valid Profile", "<tpl else>Verify Profile", "</tpl>",
    "</font></td>", "<td align='right'> <img id='{id}' align='right' src='resources/images/start.png' height=30 onclick=start('{id}')></td></tr></table>", "</tpl>" );
    My Data Passed :
    Code:
    myData = [
    {
    id : 1, status : 1, valid : 1
    },{
    id : 2, status : 1, valid : 0
    }]
    I'm passing this XTemplate to the list I have in my panel, the template in the list should change depending on the value of "valid" passed to it. But my list doesnt change !! The list tpl goes directly in the "else" loop and displays "Verify Profile" even if the valid:1 is set

    What am I doing wrong ???

    **pulling her hair out**
    Sasha

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi,

    try following code:

    Code:
    Ext.create('Ext.List', {
        fullscreen: true,
        itemTpl:new Ext.XTemplate( "<tpl if='status ==  1'>",
          "<table border=0><tr><td><font size=4><b>{time}</b></font><br><font size=3 color='gray'>",
               "<tpl if='valid ==  1'>Valid Profile",
               "<tpl else>Verify Profile",
               "</tpl>",
               "</font></td>",
             "<td align='right'> <img id='{id}' align='right' src='resources/images/start.png' height=30  onclick=start('{id}')></td></tr></table>",
            "</tpl>"
                                  )
        , data: [
              {
                  id : 1,
                  status : 1,
                  valid : 1
               },{
                    id : 2, 
                    status : 1, 
                    valid : 1
              }]
    });

    Output:

    tpl.png
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

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