View Full Version : Conditional Templates in a list

21 Mar 2011, 12:08 PM

I'm a begginer with Sencha Touch and I'm developing my first app right now. What I have here is a news reader with a simple List component. My question is, is the List component capable of showing different templates for different records in a store? For example, one line with a particular structure (title, thumbnail) and one line with a different data structure (title, subtitle and icon, for example)?

Thanx in advance

21 Mar 2011, 12:10 PM
I made thi right now:)

itemTpl: '<table border="0" width="100%" cellspacing="0" dellpadding="0"><tr><td><strong>{VNOME}</strong></td>'+
'<td align="right">{FQTY}</td></tr></table>'+
'<tpl if="BNOTES!=\'\'"><tr><td>{BNOTES}</td></tr></tpl>',

21 Mar 2011, 1:41 PM
Sure you can do that. Just have a boolean field (or whatever) in your model to determine which template you want to render, and use <tpl "if... statements appropriately.

The docs you want are here:


Go to the above link and look for the 'XTemplate' class.