A Sencha Touch itemTpl Ext.XTemplate example

This source code shows how to use the Sencha Touch Ext.XTemplate:

var tpl = new Ext.XTemplate(
    '<p>Name: {name}</p>',
    '<p>Kids: ',
    '<tpl for="kids">',
        '<p>{name} is a ',
        '<tpl if="age >= 13">',
            '<p>teenager</p>',
        '<tpl elseif="age >= 2">',
            '<p>kid</p>',
        '<tpl else>',
            '<p>baby</p>',
        '</tpl>',
    '</tpl></p>'
);

Just create your JavaScript object like that, then assign it to an itemTpl variable in your Sencha Touch view.

See this SO link for the full code and Q&A.