1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
| /**
| * @example Floating Panel
| *
| * Demonstrates some commonly used features of floating components
| */
| Ext.require('Ext.tab.Panel');
| Ext.require('Ext.window.MessageBox');
|
| Ext.onReady(function() {
|
| var panel = Ext.create('Ext.panel.Panel', {
| width: 200,
| height: 100,
| floating: true,
| draggable: true,
| title: 'Test',
| html: 'Test Panel'
| });
|
| Ext.create('Ext.button.Button', {
| renderTo: Ext.getBody(),
| margin: 10,
| text: 'Show Panel',
| handler: function() {
| panel.show(); // show the panel
| }
| });
|
| Ext.create('Ext.button.Button', {
| renderTo: Ext.getBody(),
| margin: 10,
| text: 'Hide Panel',
| handler: function() {
| panel.hide(); // hide the panel
| }
| });
|
| Ext.create('Ext.button.Button', {
| renderTo: Ext.getBody(),
| margin: 10,
| text: 'Align Panel to this button',
| handler: function() {
| // align the top left corner of the panel to the bottom right corner
| // of this button, offset by 3 pixels in each direction
| panel.alignTo(this.getEl(), 'tl-br', [3, 3]);
| }
| });
|
| Ext.create('Ext.button.Button', {
| renderTo: Ext.getBody(),
| margin: 10,
| text: 'Center Panel',
| handler: function() {
| panel.center(); // center the panel
| }
| });
|
|
| });
|
|