Created
June 18, 2014 10:21
-
-
Save gotohr/109532bdd60bb6de717b to your computer and use it in GitHub Desktop.
ExtJS 3.4 XTemplate with nested data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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