3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">Ext.onReady(function(){
\r
11 name: 'Jack Slocum',
\r
12 company: 'Ext JS, LLC',
\r
13 address: '4 Red Bulls Drive',
\r
29 var p = new Ext.Panel({
\r
30 title: 'Basic Template',
\r
32 html: '<p><i>Apply the template to see results here</i></p>',
\r
34 text: 'Apply Template',
\r
35 handler: function(){
\r
37 var tpl = new Ext.Template(
\r
38 '<p>Name: {name}</p>',
\r
39 '<p>Company: {company}</p>',
\r
40 '<p>Location: {city}, {state}</p>'
\r
43 tpl.overwrite(p.body, data);
\r
44 p.body.highlight('#c3daf9', {block:true});
\r
48 renderTo: document.body
\r
52 var p2 = new Ext.Panel({
\r
55 html: '<p><i>Apply the template to see results here</i></p>',
\r
57 text: 'Apply Template',
\r
58 handler: function(){
\r
60 var tpl = new Ext.XTemplate(
\r
61 '<p>Name: {name}</p>',
\r
62 '<p>Company: {company}</p>',
\r
63 '<p>Location: {city}, {state}</p>',
\r
65 '<tpl for="kids" if="name==\'Jack Slocum\'">',
\r
66 '<tpl if="age > 1"><p>{#}. {parent.name}\'s kid - {name}</p></tpl>',
\r
69 tpl.overwrite(p2.body, data);
\r
70 p2.body.highlight('#c3daf9', {block:true});
\r
74 renderTo: document.body
\r