Pat Emi
17 Oct 2012, 5:33 AM
Hi,
Please, i need help, on my app i want to loop through the record on my database, i want each record wrapped in a separate Xtemplate as it loops.
This is my code, it's not working...
My Model
{name: 'img', type: 'string'},
{name: 'description', type: 'string'},
My Store
Ext.create('Ext.data.Store', {
storeId : 'myStore',
model : 'dataModel',
result : [
{ img: '<img src="Com/Views/images/setraco.gif" width="50" height="50">', description:'Our services still beats competitors imaginations.<br>We are good at what we do, that makes us the best'},
{ img: '<img src="Com/Views/images/farm.jpg" width="50" height="50">', description:'So fresh, So natural, So tasty....'},
{ img: '<img src="Com/Views/images/oando.jpg" width="50" height="50">', description:'We bring it right to your doorstep'}
],
});
My Xtemplate
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<tpl if="count > 0">',
'<table class="table1" style="border: 1px solid black">',
'<tpl for="result">',
'<tr>',
'<td>{img}</td>',
'<td>{description}</td>',
'</tr>',
'</tpl>',
'</table>',
'</tpl>',
'</tpl>'
);
Thanks.
Pat.
Please, i need help, on my app i want to loop through the record on my database, i want each record wrapped in a separate Xtemplate as it loops.
This is my code, it's not working...
My Model
{name: 'img', type: 'string'},
{name: 'description', type: 'string'},
My Store
Ext.create('Ext.data.Store', {
storeId : 'myStore',
model : 'dataModel',
result : [
{ img: '<img src="Com/Views/images/setraco.gif" width="50" height="50">', description:'Our services still beats competitors imaginations.<br>We are good at what we do, that makes us the best'},
{ img: '<img src="Com/Views/images/farm.jpg" width="50" height="50">', description:'So fresh, So natural, So tasty....'},
{ img: '<img src="Com/Views/images/oando.jpg" width="50" height="50">', description:'We bring it right to your doorstep'}
],
});
My Xtemplate
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<tpl if="count > 0">',
'<table class="table1" style="border: 1px solid black">',
'<tpl for="result">',
'<tr>',
'<td>{img}</td>',
'<td>{description}</td>',
'</tr>',
'</tpl>',
'</table>',
'</tpl>',
'</tpl>'
);
Thanks.
Pat.