1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    118
    Answers
    11
    Vote Rating
    3
    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,332
    Answers
    124
    Vote Rating
    83
    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

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar