2 * Ext JS Library 2.2.1
\r
3 * Copyright(c) 2006-2009, Ext JS, LLC.
\r
4 * licensing@extjs.com
\r
6 * http://extjs.com/license
\r
9 Ext.onReady(function(){
\r
12 name: 'Jack Slocum',
\r
13 company: 'Ext JS, LLC',
\r
14 address: '4 Red Bulls Drive',
\r
30 var p = new Ext.Panel({
\r
31 title: 'Basic Template',
\r
33 html: '<p><i>Apply the template to see results here</i></p>',
\r
35 text: 'Apply Template',
\r
36 handler: function(){
\r
38 var tpl = new Ext.Template(
\r
39 '<p>Name: {name}</p>',
\r
40 '<p>Company: {company}</p>',
\r
41 '<p>Location: {city}, {state}</p>'
\r
44 tpl.overwrite(p.body, data);
\r
45 p.body.highlight('#c3daf9', {block:true});
\r
49 renderTo: document.body
\r
53 var p2 = new Ext.Panel({
\r
56 html: '<p><i>Apply the template to see results here</i></p>',
\r
58 text: 'Apply Template',
\r
59 handler: function(){
\r
61 var tpl = new Ext.XTemplate(
\r
62 '<p>Name: {name}</p>',
\r
63 '<p>Company: {company}</p>',
\r
64 '<p>Location: {city}, {state}</p>',
\r
66 '<tpl for="kids" if="name==\'Jack Slocum\'">',
\r
67 '<tpl if="age > 1"><p>{#}. {parent.name}\'s kid - {name}</p></tpl>',
\r
70 tpl.overwrite(p2.body, data);
\r
71 p2.body.highlight('#c3daf9', {block:true});
\r
75 renderTo: document.body
\r