]> git.proxmox.com Git - extjs.git/blame - extjs/build/examples/classic/core/spotlight-example.js
add extjs 6.0.1 sources
[extjs.git] / extjs / build / examples / classic / core / spotlight-example.js
CommitLineData
6527f429
DM
1Ext.Loader.setConfig({\r
2 enabled: true\r
3});\r
4\r
5Ext.require([\r
6 'Ext.layout.container.Table',\r
7 'Ext.ux.Spotlight'\r
8]);\r
9\r
10//Create a DemoPanel which is the base for each panel in the example\r
11Ext.define('DemoPanel', {\r
12 extend: 'Ext.panel.Panel',\r
13\r
14 title: 'Demo Panel',\r
15 frame: true,\r
16 width: 200,\r
17 height: 150,\r
18 html: 'Some panel content goes here!',\r
19 bodyPadding: 5,\r
20\r
21 /**\r
22 * Custom method which toggles a Ext.Button for the current panel on/off depending on the only argument\r
23 */\r
24 toggle: function(on) {\r
25 var btns = this.dockedItems.last(),\r
26 btn = btns.items.first();\r
27\r
28 if (btn) {\r
29 btn.setDisabled(!on);\r
30 }\r
31 }\r
32});\r
33\r
34Ext.onReady(function() {\r
35 //Create the spotlight component\r
36 var spot = Ext.create('Ext.ux.Spotlight', {\r
37 easing: 'easeOut',\r
38 duration: 300\r
39 });\r
40\r
41 var p1, p2, p3;\r
42\r
43 /**\r
44 * Method which changes the spotlight to be active on a spefied panel\r
45 */\r
46 var updateSpot = function(id) {\r
47 if (typeof id == 'string') {\r
48 spot.show(id);\r
49 } else if (!id && spot.active) {\r
50 spot.hide();\r
51 }\r
52\r
53 p1.toggle(id == p1.id);\r
54 p2.toggle(id == p2.id);\r
55 p3.toggle(id == p3.id);\r
56 };\r
57\r
58 Ext.widget('container', {\r
59 renderTo: Ext.getBody(),\r
60 id: 'demo-ct',\r
61 border: false,\r
62\r
63 layout: {\r
64 type: 'table',\r
65 columns: 3\r
66 },\r
67\r
68 items: [\r
69 p1 = Ext.create('DemoPanel', {\r
70 id: 'panel1',\r
71 buttons: [{\r
72 text: 'Next Panel',\r
73 disabled: true,\r
74 handler: function() {\r
75 updateSpot('panel2');\r
76 }\r
77 }]\r
78 }), p2 = Ext.create('DemoPanel', {\r
79 id: 'panel2',\r
80 buttons: [{\r
81 text: 'Next Panel',\r
82 disabled: true,\r
83 handler: function() {\r
84 updateSpot('panel3');\r
85 }\r
86 }]\r
87 }), p3 = Ext.create('DemoPanel', {\r
88 id: 'panel3',\r
89 buttons: [{\r
90 text: 'Done',\r
91 disabled: true,\r
92 handler: function() {\r
93 updateSpot(false);\r
94 }\r
95 }]\r
96 })]\r
97 });\r
98\r
99 //The start button, which starts everything\r
100 Ext.create('Ext.button.Button', {\r
101 text: 'Start',\r
102 renderTo: 'start-ct',\r
103 handler: function() {\r
104 updateSpot('panel1');\r
105 }\r
106 });\r
107});\r