panel.js
3.66 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
Ext.require([
'*'
]);
Ext.onReady(function() {
var html = '<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, '+
'porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, '+
'lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis '+
'vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.<br/><br/>'+
'Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing '+
'eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt '+
'diam nec urna. Curabitur velit. Lorem ipsum dolor sit amet.</p>';
var configs = [{
title: 'Basic Panel',
collapsible:true,
width:400,
html: html
},{
width: 320,
height: 320,
title: 'Masked Panel with a really long title',
bodyStyle: "padding: 5px;",
html: 'Some content',
collapsible: true,
collapseDirection: Ext.Component.DIRECTION_LEFT,
listeners: {
render: function(p){
p.body.mask('Loading...');
},
delay: 50
}
},{
width: 150,
height: 150,
unstyled: true,
title: 'Panel with unstyled:true',
bodyPadding: 0,
html: 'Some content'
},{
width: 150,
height: 150,
border: false,
frame: true,
title: 'Panel with border:false',
html: 'Some content'
},{
title: 'Framed panel: Width 280/Height 180',
html: html,
collapsible: true,
frame: true,
autoScroll: true,
width: 280,
height: 180
},{
title : 'Panel as child',
width : 500,
height: 400,
layout: 'fit',
bodyStyle: 'padding:5px',
items: [
{
xtype: 'panel',
border: false,
layout: {
type: 'vbox',
align: 'stretch'
},
items: [
{
html: 'top, with no title',
height: 100,
margin: '0 0 5 0'
},{
xtype: 'panel',
title: 'test',
html: 'bottom',
flex: 1
}
]
}
]
},{
title : 'Framed panel as child',
width : 300,
height: 100,
html : null,
layout: 'fit',
items: [
{
xtype: 'panel',
title: 'Framed panel',
html : '123',
frame: true
}
]
},{
title : 'Framed panel with normal child',
width : 300,
height: 100,
html : null,
frame: true,
layout: 'fit',
items: [
{
xtype: 'panel',
title: 'Non-framed child',
html : 'Hello'
}
]
},{
title: 'Width 180/No Height',
animCollapse: true,
collapsible: true,
width: 180,
html: html
}];
Ext.each(configs, function(config) {
var element = Ext.getBody().createChild({cls: 'panel-container'});
Ext.widget('panel', Ext.applyIf(config, {
renderTo: element,
bodyPadding: 7
}));
});
});