3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
7 Ext.onReady(function(){
\r
10 name: 'Jack Slocum',
\r
11 company: 'Ext JS, LLC',
\r
12 address: '4 Red Bulls Drive',
\r
28 var p = new Ext.Panel({
\r
29 title: 'Basic Template',
\r
31 html: '<p><i>Apply the template to see results here</i></p>',
\r
33 text: 'Apply Template',
\r
34 handler: function(){
\r
36 var tpl = new Ext.Template(
\r
37 '<p>Name: {name}</p>',
\r
38 '<p>Company: {company}</p>',
\r
39 '<p>Location: {city}, {state}</p>'
\r
42 tpl.overwrite(p.body, data);
\r
43 p.body.highlight('#c3daf9', {block:true});
\r
47 renderTo: document.body
\r
51 var p2 = new Ext.Panel({
\r
54 html: '<p><i>Apply the template to see results here</i></p>',
\r
56 text: 'Apply Template',
\r
57 handler: function(){
\r
59 var tpl = new Ext.XTemplate(
\r
60 '<p>Name: {name}</p>',
\r
61 '<p>Company: {company}</p>',
\r
62 '<p>Location: {city}, {state}</p>',
\r
64 '<tpl for="kids" if="name==\'Jack Slocum\'">',
\r
65 '<tpl if="age > 1"><p>{#}. {parent.name}\'s kid - {name}</p></tpl>',
\r
68 tpl.overwrite(p2.body, data);
\r
69 p2.body.highlight('#c3daf9', {block:true});
\r
73 renderTo: document.body
\r