1 Ext.require('widget.panel');
3 Ext.onReady(function(){
7 address: '525 University Ave',
23 Ext.create('Ext.Panel', {
25 renderTo: 'template-example',
27 bodyStyle: "padding:5px;font-size:11px;",
28 title: 'Basic Template',
30 text: 'Apply Template',
33 var panel = this.up("panel"),
34 tpl = Ext.create('Ext.Template',
35 '<p>Name: {name}</p>',
36 '<p>Company: {company}</p>',
37 '<p>Location: {city}, {state}</p>'
40 tpl.overwrite(panel.body, data);
41 panel.doComponentLayout();
45 html: '<p><i>Apply the template to see results here</i></p>'
48 Ext.create('Ext.Panel', {
50 renderTo: 'xtemplate-example',
52 bodyStyle: "padding:5px;font-size:11px;",
55 text: 'Apply Template',
58 var panel = this.up('panel'),
59 tpl =Ext.create('Ext.XTemplate',
60 '<p>Name: {name}</p>',
61 '<p>Company: {company}</p>',
62 '<p>Location: {city}, {state}</p>',
64 '<tpl for="kids" if="name==\'Abe Elias\'">',
65 '<tpl if="age > 1"><p>{#}. {parent.name}\'s kid - {name}</p></tpl>',
68 tpl.overwrite(panel.body, data);
69 panel.doComponentLayout();
73 html: '<p><i>Apply the template to see results here</i></p>'