-
24 Aug 2012 3:33 AM #1
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
My Data Passed :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>" );
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 setCode:myData = [ {id : 1, status : 1, valid : 1},{id : 2, status : 1, valid : 0}]
What am I doing wrong ???
**pulling her hair out**
Sasha
-
24 Aug 2012 4:11 AM #2Sencha - Community Support Team
- Join Date
- May 2012
- Location
- Istanbul
- Posts
- 1,331
- Vote Rating
- 76
- Answers
- 124
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.pngsword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.


Reply With Quote