3 <title>Test Case for Ext JS</title>
6 <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
10 <link rel="stylesheet" type="text/css" href="/ext-versions/ext-3.0.3/resources/css/ext-all.css" />
13 <link rel="stylesheet" type="text/css" href="resources/bubble-f1eedd.css" />
16 <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
17 <script type="text/javascript" src="../../ext-all-debug.js"></script>
18 <script type="text/javascript" src="../../examples/ux/TabCloseMenu.js"></script>
21 <script type="text/javascript" src="/ext-versions/ext-3.0.3/adapter/ext/ext-base.js"></script>
22 <script type="text/javascript" src="/ext-versions/ext-3.0.3/ext-all.js"></script>
23 <script type="text/javascript" src="/ext-versions/ext-3.0.3/examples/ux/TabCloseMenu.js"></script>
26 <script type="text/javascript" src="resources/form-configs.js"></script>
27 <script type="text/javascript" src="resources/grid-configs.js"></script>
29 <script type="text/javascript">
30 Ext.BLANK_IMAGE_URL = '../../resources/images/default/s.gif';
33 <style type="text/css">
35 background-color: #d9d9bd;
36 font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
40 margin: 0; padding: 0; border: 0 none; overflow: hidden;
41 height: 100%; width: 100%;
43 .x-btn, .x-btn button { font-size: 12px; }
44 .x-border-layout-ct { background-color: #d9d9bd; }
45 .tabs-onerow ul.x-tab-strip { width: 10000px !important; }
46 .tabs-multirow ul.x-tab-strip { width: auto !important; }
49 background-color: #c07c69;
56 background-image: url(resources/tabs.gif) !important;
59 background-image: url(resources/application_add.gif) !important;
61 #action-panel { background-color: #aabb69; color: #fff; }
62 #action-panel h2 { font-size: 13px; }
63 #content-panel { background-color: #f1eedd; }
67 -moz-border-radius: 5px;
68 -webkit-border-radius: 5px;
71 font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
74 .content-class h3, .content-class h2 {
96 <script type="text/javascript">
98 var contentPanel; // for quick access to the card content panel.
99 var tabPanelOne; // reference to card one tab panel.
100 var tabPanelTwo; // reference to card two tab panel.
104 Ext.onReady(function() {
106 // For creating a tab panel.
107 function createTabPanel(config) {
109 var tabPanel = new Ext.TabPanel({
116 enableTabScroll: false,
117 cls: 'tabs-multirow',
118 plugins: new Ext.ux.TabCloseMenu(),
126 baseCls: 'content-class',
128 'background': 'transparent', 'padding': '15px 20px'
133 title: config.tabTitle
136 tabPanel.on('remove', function(tab){
139 tabPanel.getItem(0).on('afterrender', function(){
140 this.body.update(Ext.getDom(this.id + '-content').innerHTML);
146 contentPanel = new Ext.Panel({
159 'background': 'transparent'
163 bodyStyle: { 'background': 'transparent' }
167 id: 'card-panel-one',
168 tabId: 'card-panel-one-tab',
169 tabTitle: 'Card tabPanel One'
172 id: 'card-panel-two',
173 tabId: 'card-panel-two-tab',
174 tabTitle: 'Card tabPanel Two'
179 tabPanelOne = Ext.getCmp('card-panel-one');
180 tabPanelTwo = Ext.getCmp('card-panel-two');
183 var actionPanel = new Ext.Panel({
189 title: 'Action Items',
199 'padding': '15px 20px',
200 'background': 'transparent'
204 html: [ '<h2>Card One</h2>', '<div class="h-bar"></div>' ]
206 xtype: 'button', width: 158, text: 'Show Card One',
207 handler: function(){ contentPanel.layout.setActiveItem(0); }
210 html: [ '<div class="h-bar"></div>' ]
212 xtype: 'button', width: 158, text: 'Add 1 Form',
213 handler: function(){ addForm(0, tabPanelOne, 1); }
215 xtype: 'button', width: 158, text: 'Add 5 Forms',
216 handler: function(){ addForm(0, tabPanelOne, 5); }
218 xtype: 'button', width: 158, text: 'Add 10 Forms',
219 handler: function(){ addForm(0, tabPanelOne, 10); }
221 xtype: 'button', width: 158, text: 'Add 1 Grid',
222 handler: function(){ addGrid(0, tabPanelOne, 1); }
224 xtype: 'button', width: 158, text: 'Add 5 Grids',
225 handler: function(){ addGrid(0, tabPanelOne, 5); }
227 xtype: 'button', width: 158, text: 'Add 10 Grids',
228 handler: function(){ addGrid(0, tabPanelOne, 10); }
230 xtype: 'box', height: 15
233 html: [ '<h2>Card Two</h2>', '<div class="h-bar"></div>' ]
235 xtype: 'button', width: 158, text: 'Show Card Two',
236 handler: function(){ contentPanel.layout.setActiveItem(1); }
239 html: [ '<div class="h-bar"></div>' ]
241 xtype: 'button', width: 158, text: 'Add 1 Form',
242 handler: function(){ addForm(1, tabPanelTwo, 1); }
244 xtype: 'button', width: 158, text: 'Add 5 Forms',
245 handler: function(){ addForm(1, tabPanelTwo, 5); }
247 xtype: 'button', width: 158, text: 'Add 10 Forms',
248 handler: function(){ addForm(1, tabPanelTwo, 10); }
250 xtype: 'button', width: 158, text: 'Add 1 Grid',
251 handler: function(){ addGrid(1, tabPanelTwo, 1); }
253 xtype: 'button', width: 158, text: 'Add 5 Grids',
254 handler: function(){ addGrid(1, tabPanelTwo, 5); }
256 xtype: 'button', width: 158, text: 'Add 10 Grids',
257 handler: function(){ addGrid(1, tabPanelTwo, 10); }
262 var viewPort = new Ext.Viewport({
264 renderTo: 'body-viewport',
265 items: [ actionPanel, contentPanel ]
270 function fixPanelHeight(tab) {
272 // This is needed when a multi-tab row is added or removed
273 // to fix the underlying tab container height.
276 if (Math.abs(tab.container.getHeight() - tab.getHeight()) > 2) {
277 // tab.lastSize = null; // forces recalc
278 tab.setHeight(tab.container.getHeight() - 1);
279 tab.setHeight(tab.container.getHeight() - 2);
284 function addForm(cardIndex, tabPanel, limit) {
286 contentPanel.layout.setActiveItem(cardIndex);
292 var tab = tabPanel.add({
293 id: 'new-form-' + (++newTabCount),
294 title: 'New Form #' + newTabCount,
299 fixPanelHeight(tabPanel);
302 // Below is something one can have in server side scripting
303 // and adding via load or the autoLoad method. Just past the
304 // the id via params.
306 // The key thing here is to use the actual tab's add method
307 // to populate the tab body area. Everything added here
308 // should be destroyed automatically when the tab is closed.
310 var c = Ext.getCmp('new-form-' + newTabCount);
314 html: '<h3>New Form #' + newTabCount + '</h3>'
316 // c.add(formConfigs[newTabCount % 2]);
317 c.add(formConfigs[cardIndex]);
326 function addGrid(cardIndex, tabPanel, limit) {
328 contentPanel.layout.setActiveItem(cardIndex);
334 var tab = tabPanel.add({
335 id: 'new-grid-' + (++newTabCount),
336 title: 'New Grid #' + newTabCount,
341 fixPanelHeight(tabPanel);
344 var c = Ext.getCmp('new-grid-' + newTabCount);
348 html: '<h3>New Grid #' + newTabCount + '</h3>'
350 // c.add(gridConfigs[newTabCount % 2]);
351 c.add(gridConfigs[0]);
364 <div id="body-viewport"></div>
365 <div id="card-panel-one-tab-content" class="x-hidden">
366 <h3>This is tabPanel One</h3>
367 <p>Click a button under Action Items.</p>
369 <div id="card-panel-two-tab-content" class="x-hidden">
370 <h3>This is tabPanel Two</h3>
371 <p>Click a button under Action Items.</p>