Reputation: 178
I have the following template:
myStore.on('load', function(store, records, options) {
console.log(records);
alert("loaded.");
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<h1>{name} test</h1>',
'<h1>{origin}</h1>',
'</tpl>'
);
tpl.append(Ext.get("output-body"), myStore);
});
It loops through my store which has 3 records:
accounts { id="accounts-ext-record-1", internalId="ext-record-1"}
name = "Network" origin = "Support_4" id = undefined
accounts { id="accounts-ext-record-2", internalId="ext-record-2"}
name = "new" origin = "nevil-nmshub" id = undefined
accounts { id="accounts-ext-record-3", internalId="ext-record-3"}
name = "soap" origin = "network" id = undefined
When I run the code I get:
test
test
test
What am I missing to output the values of "name" and "origin"? Something is working as its obvioulsy seeting the 3 accounts hence the 3 prints of "test". Thanks
Upvotes: 0
Views: 933
Reputation: 178
I needed to add data. in my tpl.
var tpl = new Ext.XTemplate(
'<tpl for=".">',
'<h1>{data.name} test</h1>',
'<h1>{data.origin}</h1>',
'</tpl>'
);
Upvotes: 1