Skip to content

Instantly share code, notes, and snippets.

@gotohr
Created June 18, 2014 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gotohr/109532bdd60bb6de717b to your computer and use it in GitHub Desktop.
Save gotohr/109532bdd60bb6de717b to your computer and use it in GitHub Desktop.
ExtJS 3.4 XTemplate with nested data
var data = [
{ id: 1, subdata: { x: 10, y: 20 } },
{ id: 2, subdata: { x: 20, y: 30 } }
];
var tpl = new Ext.XTemplate([
'<tpl for=".">',
'<p>ID: {id}</p>',
'<tpl for="subdata">',
'<div style="margin-left: 10px">',
'<p>x: {x}</p>',
'<p>y: {y}</p>',
'</div>',
'</tpl>',
'</tpl>'
]);
var pnl = new Ext.Panel({
autoHeight: true,
html: tpl.apply(data),
layout: 'fit',
style: {
padding: '2px',
margin: '2px'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment