3 <title>Test Case for Ext JS</title>
7 <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
12 <link rel="stylesheet" type="text/css" href="/ext-versions/ext-3.0.3/resources/css/ext-all.css" />
15 <link rel="stylesheet" type="text/css" href="resources/bubble-f1eedd.css" />
19 <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
20 <script type="text/javascript" src="../../ext-all-debug.js"></script>
21 <script type="text/javascript" src="../../examples/ux/TabCloseMenu.js"></script>
26 <script type="text/javascript" src="/ext-versions/ext-3.0.3/adapter/ext/ext-base.js"></script>
27 <script type="text/javascript" src="/ext-versions/ext-3.0.3/ext-all-debug.js"></script>
28 <script type="text/javascript" src="/ext-versions/ext-3.0.3/examples/ux/TabCloseMenu.js"></script>
30 <script type="text/javascript" src="resources/form-configs.js"></script>
31 <script type="text/javascript" src="resources/grid-configs.js"></script>
33 <script type="text/javascript">
34 Ext.BLANK_IMAGE_URL = '../../resources/images/default/s.gif';
35 Ext.form.HtmlEditor.override({
38 return Ext.isIE ? this.getWin().document : (this.iframe.contentDocument || this.getWin().document);
43 <style type="text/css">
45 background-color: #d9d9bd;
46 font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
50 margin: 0; padding: 0; border: 0 none; overflow: hidden;
51 height: 100%; width: 100%;
53 .x-btn, .x-btn button { font-size: 12px; }
54 .x-border-layout-ct { background-color: #d9d9bd; }
55 .tabs-onerow ul.x-tab-strip { width: 10000px !important; }
56 .tabs-multirow ul.x-tab-strip { width: auto !important; }
59 background-color: #c07c69;
66 background-image: url(resources/tabs.gif) !important;
69 background-image: url(resources/application_add.gif) !important;
71 #action-panel { background-color: #aabb69; color: #fff; }
72 #action-panel h2 { font-size: 13px; }
73 #content-panel { background-color: #f1eedd; }
77 -moz-border-radius: 5px;
78 -webkit-border-radius: 5px;
81 font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
84 .content-class h3, .content-class h2 {
106 <script type="text/javascript">
108 var contentPanel; // for quick access to the card content panel.
109 var tabPanelOne; // reference to card one tab panel.
110 var tabPanelTwo; // reference to card two tab panel.
114 Ext.onReady(function() {
116 // For creating a tab panel.
117 function createTabPanel(config) {
119 var tabPanel = new Ext.TabPanel({
126 enableTabScroll: false,
127 cls: 'tabs-multirow',
128 plugins: new Ext.ux.TabCloseMenu(),
136 baseCls: 'content-class',
138 'background': 'transparent', 'padding': '15px 20px'
143 title: config.tabTitle
146 tabPanel.on('remove', function(tab){
149 tabPanel.getItem(0).on('afterrender', function(){
150 this.body.update(Ext.getDom(this.id + '-content').innerHTML);
156 contentPanel = new Ext.Panel({
169 'background': 'transparent'
173 bodyStyle: { 'background': 'transparent' }
177 id: 'card-panel-one',
178 tabId: 'card-panel-one-tab',
179 tabTitle: 'Card tabPanel One'
182 id: 'card-panel-two',
183 tabId: 'card-panel-two-tab',
184 tabTitle: 'Card tabPanel Two'
189 tabPanelOne = Ext.getCmp('card-panel-one');
190 tabPanelTwo = Ext.getCmp('card-panel-two');
193 var actionPanel = new Ext.Panel({
199 title: 'Action Items',
209 'padding': '15px 20px',
210 'background': 'transparent'
214 html: [ '<h2>Card One</h2>', '<div class="h-bar"></div>' ]
216 xtype: 'button', width: 158, text: 'Show Card One',
217 handler: function(){ contentPanel.layout.setActiveItem(0); }
220 html: [ '<div class="h-bar"></div>' ]
222 xtype: 'button', width: 158, text: 'Add 1 Form',
223 handler: function(){ addForm(0, tabPanelOne, 1); }
225 xtype: 'button', width: 158, text: 'Add 5 Forms',
226 handler: function(){ addForm(0, tabPanelOne, 5); }
228 xtype: 'button', width: 158, text: 'Add 10 Forms',
229 handler: function(){ addForm(0, tabPanelOne, 10); }
231 xtype: 'button', width: 158, text: 'Add 1 Grid',
232 handler: function(){ addGrid(0, tabPanelOne, 1); }
234 xtype: 'button', width: 158, text: 'Add 5 Grids',
235 handler: function(){ addGrid(0, tabPanelOne, 5); }
237 xtype: 'button', width: 158, text: 'Add 10 Grids',
238 handler: function(){ addGrid(0, tabPanelOne, 10); }
240 xtype: 'box', height: 15
243 html: [ '<h2>Card Two</h2>', '<div class="h-bar"></div>' ]
245 xtype: 'button', width: 158, text: 'Show Card Two',
246 handler: function(){ contentPanel.layout.setActiveItem(1); }
249 html: [ '<div class="h-bar"></div>' ]
251 xtype: 'button', width: 158, text: 'Add 1 Form',
252 handler: function(){ addForm(1, tabPanelTwo, 1); }
254 xtype: 'button', width: 158, text: 'Add 5 Forms',
255 handler: function(){ addForm(1, tabPanelTwo, 5); }
257 xtype: 'button', width: 158, text: 'Add 10 Forms',
258 handler: function(){ addForm(1, tabPanelTwo, 10); }
260 xtype: 'button', width: 158, text: 'Add 1 Grid',
261 handler: function(){ addGrid(1, tabPanelTwo, 1); }
263 xtype: 'button', width: 158, text: 'Add 5 Grids',
264 handler: function(){ addGrid(1, tabPanelTwo, 5); }
266 xtype: 'button', width: 158, text: 'Add 10 Grids',
267 handler: function(){ addGrid(1, tabPanelTwo, 10); }
272 var viewPort = new Ext.Viewport({
274 renderTo: 'body-viewport',
275 items: [ actionPanel, contentPanel ]
280 function fixPanelHeight(tab) {
282 // This is needed when a multi-tab row is added or removed
283 // to fix the underlying tab container height.
286 if (Math.abs(tab.container.getHeight() - tab.getHeight()) > 2) {
287 // tab.lastSize = null; // forces recalc
288 tab.setHeight(tab.container.getHeight() - 1);
289 tab.setHeight(tab.container.getHeight() - 2);
294 function addForm(cardIndex, tabPanel, limit) {
296 contentPanel.layout.setActiveItem(cardIndex);
302 var tab = tabPanel.add({
303 id: 'new-form-' + (++newTabCount),
304 title: 'New Form #' + newTabCount,
309 fixPanelHeight(tabPanel);
312 // Below is something one can have in server side scripting
313 // and adding via load or the autoLoad method. Just past the
314 // the id via params.
316 // The key thing here is to use the actual tab's add method
317 // to populate the tab body area. Everything added here
318 // should be destroyed automatically when the tab is closed.
320 var c = Ext.getCmp('new-form-' + newTabCount);
324 html: '<h3>New Form #' + newTabCount + '</h3>'
326 // c.add(formConfigs[newTabCount % 2]);
327 c.add(formConfigs[cardIndex]);
336 function addGrid(cardIndex, tabPanel, limit) {
338 contentPanel.layout.setActiveItem(cardIndex);
344 var tab = tabPanel.add({
345 id: 'new-grid-' + (++newTabCount),
346 title: 'New Grid #' + newTabCount,
351 fixPanelHeight(tabPanel);
354 var c = Ext.getCmp('new-grid-' + newTabCount);
358 html: '<h3>New Grid #' + newTabCount + '</h3>'
360 // c.add(gridConfigs[newTabCount % 2]);
361 c.add(gridConfigs[0]);
374 <div id="body-viewport"></div>
375 <div id="card-panel-one-tab-content" class="x-hidden">
376 <h3>This is tabPanel One</h3>
377 <p>Click a button under Action Items.</p>
379 <div id="card-panel-two-tab-content" class="x-hidden">
380 <h3>This is tabPanel Two</h3>
381 <p>Click a button under Action Items.</p>