Skip to content

Instantly share code, notes, and snippets.

@nelstrom
Created October 19, 2010 17:01
Show Gist options
  • Save nelstrom/634571 to your computer and use it in GitHub Desktop.
Save nelstrom/634571 to your computer and use it in GitHub Desktop.
var data = {
name: 'Tommy Maintz',
title: 'Lead Developer',
company: 'Ext JS, Inc',
email: 'tommy@extjs.com',
address: '5 Cups Drive',
city: 'Palo Alto',
state: 'CA',
zip: '44102',
drinks: ['Coffee', 'Soda', 'Water'],
kids: [
{name: 'Adrian', age:13},
{name: 'Grace', age:8},
{name: 'Joshua', age:3},
{name: 'Matthew', age:2},
{name: 'Solomon', age:0}
]
};
var content, tpl;
tpl = new Ext.XTemplate(
'<p>Name: {name}</p>',
'<p>Kids: ',
'<tpl for="kids">',
'<tpl if="age &gt; 1">',
'<p>{name}</p>',
'<p>Dad: {[parent.name]}</p>',
'</tpl>',
'</tpl></p>'
);
Ext.setup({
onReady: function() {
content = new Ext.Panel({
fullscreen: true,
tpl: tpl
})
content.update(data);
}
});
<!DOCTYPE html>
<html>
<head>
<title>Sencha Touch</title>
<link rel="stylesheet" href="sencha/097/ext-touch-debug.css" type="text/css">
<link rel="stylesheet" href="stylesheets/scratch.css" type="text/css" media="screen" title="no title" charset="utf-8"/>
<script type="text/javascript" src="sencha/097/ext-touch-debug.js"> </script>
<script src="javascripts/data.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/example3.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment