I am using the framwork Sencha Touch 2 and now i have a problem when create a List component because i create a XTemplate for this, but i need insert a button component in each element for the list
{
xtype: 'list',
id: 'list_product',
emptyText: '<div class="list-empty-text">No hay coincidencias</div>',
store: 'Product',
itemTpl: Ext.create('Ext.XTemplate',
'<h3>{name}</h3>' +
'[{xtype:"button"}]'//Here i tried insert a button
),
items: [
{
xtype: 'toolbar',
docked: 'top',
items: [
{xtype: 'spacer'},
{
xtype: 'searchfield',
placeHolder: 'Buscar...'
},
{xtype: 'spacer'}
]
}
]
}
I read the documentation, but i not see a example or some code help.
You cannot use
itemTplandXTemplatein that manner. Templates are written as HTML, whereas you are mixing HTML and Javascript in yourXTemplateIn order to do what you want, you will need to use
dataviewanddataitem. For examples of how to use them, consult the Dataview guide and docs