]> git.proxmox.com Git - extjs.git/blame - extjs/examples/classic/platform/templates.js
add extjs 6.0.1 sources
[extjs.git] / extjs / examples / classic / platform / templates.js
CommitLineData
6527f429
DM
1Ext.require('Ext.panel.Panel');\r
2\r
3Ext.onReady(function(){\r
4 var data = {\r
5 name: 'Abe Elias',\r
6 company: 'Sencha Inc',\r
7 address: '525 University Ave',\r
8 city: 'Palo Alto',\r
9 state: 'California',\r
10 zip: '44102',\r
11 kids: [{\r
12 name: 'Solomon',\r
13 age:3\r
14 },{\r
15 name: 'Rebecca',\r
16 age:2\r
17 },{\r
18 name: 'Rebecca 1',\r
19 age:0\r
20 }]\r
21 };\r
22\r
23 new Ext.panel.Panel({\r
24 width: 300,\r
25 renderTo: 'template-example',\r
26 margin: 15,\r
27 bodyPadding: 5,\r
28 title: 'Basic Template',\r
29 tpl: [\r
30 '<p>Name: {name}</p>',\r
31 '<p>Company: {company}</p>',\r
32 '<p>Location: {city}, {state}</p>'\r
33 ],\r
34 tbar: [{\r
35 text: 'Apply Template',\r
36 handler: function() {\r
37 this.up('panel').update(data);\r
38 }\r
39 }],\r
40 html: '<p><i>Apply the template to see results here</i></p>'\r
41 });\r
42\r
43 new Ext.panel.Panel({\r
44 width: 300,\r
45 renderTo: 'xtemplate-example',\r
46 margin: 15,\r
47 bodyPadding: 5,\r
48 title: 'XTemplate',\r
49 tpl: [\r
50 '<p>Name: {name}</p>',\r
51 '<p>Company: {company}</p>',\r
52 '<p>Location: {city}, {state}</p>',\r
53 '<p>Kids: ',\r
54 '<tpl for="kids">',\r
55 '<tpl if="age &gt; 1"><p>{#}. {parent.name}\'s kid - {name}</p></tpl>',\r
56 '</tpl></p>'\r
57 ],\r
58 tbar: [{\r
59 text: 'Apply Template',\r
60 handler: function() {\r
61 this.up('panel').update(data);\r
62 }\r
63 }],\r
64 html: '<p><i>Apply the template to see results here</i></p>'\r
65 });\r
66});