-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtab-panel-example.html
More file actions
executable file
·161 lines (125 loc) · 3.83 KB
/
tab-panel-example.html
File metadata and controls
executable file
·161 lines (125 loc) · 3.83 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<html>
<head>
<title>Ext.Element</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<style>
body{
background-color:#aeaeae;
}
#container{
background-color:#ccc;
}
</style>
<script src="extjs/adapter/ext/ext-base.js"></script>
<script src="extjs/ext-all-debug.js"></script>
<script>
Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif';
Ext.onReady(function () {
// a very basic TabPanel instantiation and render
var tabs = new Ext.TabPanel({
renderTo: Ext.getBody(),
activeTab: 0,
items: [{
title: 'Tab 1',
html: 'A simple tab'
},{
title: 'Tab 2',
html: 'Another one'
}]
});
/* 2)
// some more Tab options
// "disabled": unavailable tab
// "closable": whether a user can close the tab
var simpleTab = {
title : 'Simple tab',
id : 'simpleTab',
html : 'Your first tab!'
};
var closableTab = {
title : 'I am closable',
html : 'Please close when done reading.',
closable : true
};
var disabledTab = {
title : 'Disabled tab',
id : 'disabledTab',
html : 'Peekaboo!',
disabled : true,
closable : true
};
// enableTabScroll: for when there are more tabs than horiz. space
// note: defaultType for TabPanel items is Panel
var tabPanel = new Ext.TabPanel({
activeTab : 0,
id : 'myTPanel',
enableTabScroll : true,
items : [
simpleTab,
closableTab,
disabledTab,
]
});
new Ext.Window({
height : 300,
width : 400,
layout : 'fit',
items : tabPanel
}).show();
// Managing Tab Items
// can use add(), remove(), insert(), inherited from Ext.Container
var tPanel = Ext.getCmp('myTPanel');
tPanel.add({
title : 'New tab',
id : 'myNewTab'
});
// set Active Tab by id
tPanel.setActiveTab('myNewTab');
// enable/disable inline
Ext.getCmp('disabledTab').enable();
// hide tabs with utility method
Ext.getCmp('myTPanel').hideTabStripItem('disabledTab');
// Ext.getCmp('myTPanel').unHideTabStripItem('disabledTab');
*/ // end 2)
/* 3)
// Another Tab initialization example
Ext.QuickTips.init();
new Ext.Viewport({
layout : 'fit',
title : 'Exercising scrollable tabs',
items : {
layout: 'fit',
title: 'Tabs',
items: {
xtype: 'tabpanel',
activeTab: 0,
id: 'myTPanel',
enableTabScroll: true,
items: [
{
title: "First tab!"
}
]
}
}
});
// anonymous function to render out lots of tabs
(function(num){
for (var i = 1; i <= 30; i++) {
var title = "Long tab title # " + i;
Ext.getCmp('myTPanel').add({
title : title,
html : 'Hi, i am tab ' + i,
tabTip : title,
closable : true
});
}
}).defer(500);
*/ // end 3)
});
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>