3
* Copyright(c) 2006-2009, Ext JS, LLC.
6
* http://extjs.com/license
10
// Note that these are all defined as panel configs, rather than instantiated
11
// as panel objects. You could just as easily do this instead:
13
// var absolute = new Ext.Panel({ ... });
15
// However, by passing configs into the main container instead of objects, we can defer
16
// layout AND object instantiation until absolutely needed. Since most of these panels
17
// won't be shown by default until requested, this will save us some processing
18
// time up front when initially rendering the page.
20
// Since all of these configs are being added into a layout container, they are
21
// automatically assumed to be panel configs, and so the xtype of 'panel' is
22
// implicit. To define a config of some other type of component to be added into
23
// the layout, simply provide the appropriate xtype config explicitly.
26
* ================ Start page config =======================
28
// The default start page, also a simple example of a FitLayout.
33
bodyStyle: 'padding:25px',
34
contentEl: 'start-div' // pull existing content from the page
38
* ================ AnbsoluteLayout config =======================
42
title: 'Absolute Layout',
45
bodyStyle: 'padding:15px;',
54
html: 'Positioned at x:50, y:50'
59
html: 'Positioned at x:125, y:125'
64
* ================ AccordionLayout config =======================
68
title: 'Accordion Layout',
70
bodyBorder: false, // useful for accordion containers since the inner panels have borders already
71
bodyStyle: 'background-color:#DFE8F6', // if all accordion panels are collapsed, this looks better in this layout
72
defaults: {bodyStyle: 'padding:15px'},
74
title: 'Introduction',
75
tools: [{id:'gear'},{id:'refresh'}],
76
html: '<p>Here is some accordion content. Click on one of the other bars below for more.</p>'
78
title: 'Basic Content',
79
html: '<br /><p>More content. Open the third panel for a customized look and feel example.</p>',
82
text: 'Show Next Panel',
84
Ext.getCmp('acc-custom').expand(true);
89
title: 'Custom Panel Look and Feel',
90
cls: 'custom-accordion', // look in layout-browser.css to see the CSS rules for this class
91
html: '<p>Here is an example of how easy it is to completely customize the look and feel of an individual panel simply by adding a CSS class in the config.</p>'
96
* ================ AnchorLayout config =======================
100
title: 'Anchor Layout',
102
defaults: {bodyStyle: 'padding:15px'},
107
html: '<p>Width = 50% of the container</p>'
112
html: '<p>Width = container width - 100 pixels</p>'
116
html: '<p>Width = container width - 10 pixels</p><p>Height = container height - 262 pixels</p>'
121
* ================ BorderLayout config =======================
125
title: 'Border Layout',
134
bodyStyle: 'padding:15px'
143
html: '<p>Footer content</p>'
153
html: '<p>Secondary content like navigation links could go here</p>'
155
title: 'Main Content',
159
html: '<h1>Main Page</h1><p>This is where the main content would go</p>'
164
* ================ CardLayout config (TabPanel) =======================
166
// Note that the TabPanel component uses an internal CardLayout -- it's not
167
// something you have to explicitly configure. However, it's still a perfect
168
// example of how this layout style can be used in a complex component.
171
id: 'card-tabs-panel',
172
plain: true, //remove the header border
174
defaults: {bodyStyle: 'padding:15px'},
177
html: 'This is tab 1 content.'
180
html: 'This is tab 2 content.'
183
html: 'This is tab 3 content.'
187
// This is a fake CardLayout navigation function. A real implementation would
188
// likely be more sophisticated, with logic to validate navigation flow. It will
189
// be assigned next as the handling function for the buttons in the CardLayout example.
190
var cardNav = function(incr){
191
var l = Ext.getCmp('card-wizard-panel').getLayout();
192
var i = l.activeItem.id.split('card-')[1];
193
var next = parseInt(i) + incr;
194
l.setActiveItem(next);
195
Ext.getCmp('card-prev').setDisabled(next==0);
196
Ext.getCmp('card-next').setDisabled(next==2);
200
* ================ CardLayout config (Wizard) =======================
203
id:'card-wizard-panel',
204
title: 'Card Layout (Wizard)',
207
bodyStyle: 'padding:15px',
208
defaults: {border:false},
211
text: '« Previous',
212
handler: cardNav.createDelegate(this, [-1]),
216
text: 'Next »',
217
handler: cardNav.createDelegate(this, [1])
221
html: '<h1>Welcome to the Demo Wizard!</h1><p>Step 1 of 3</p><p>Please click the "Next" button to continue...</p>'
224
html: '<p>Step 2 of 3</p><p>Almost there. Please click the "Next" button to continue...</p>'
227
html: '<h1>Congratulations!</h1><p>Step 3 of 3 - Complete</p>'
232
* ================ ColumnLayout config =======================
236
title: 'Column Layout',
238
bodyStyle:'padding:5px',
239
defaults: {bodyStyle:'padding:15px'},
241
title: 'Width = .25',
243
html: '<p>This is some short content.</p>'
245
title: 'Width = .75',
247
html: '<p>This is some longer content.</p><p>This is some longer content.</p><p>This is some longer content.</p><p>This is some longer content.</p><p>This is some longer content.</p><p>This is some longer content.</p>'
249
title: 'Width = 250px',
251
html: 'Not much here!'
256
* ================ FitLayout config =======================
263
title: 'Inner Panel',
264
html: '<p>This panel is fit within its container.</p>',
265
bodyStyle: 'margin:15px',
271
* ================ FormLayout config =======================
273
// NOTE: While you can create a basic Panel with layout:'form', practically
274
// you should usually use a FormPanel to also get its form-specific functionality.
275
// Note that the layout config is not required on FormPanels.
277
xtype: 'form', // since we are not using the default 'panel' xtype, we must specify it
280
title: 'Form Layout',
281
bodyStyle:'padding:15px',
291
defaultType: 'textfield',
293
fieldLabel: 'First Name',
297
fieldLabel: 'Last Name',
300
fieldLabel: 'Company',
308
buttons: [{text: 'Save'},{text: 'Cancel'}]
312
* ================ TableLayout config =======================
316
title: 'Table Layout',
322
bodyStyle:'padding:15px 20px'
325
title: 'Lots of Spanning',
326
html: '<p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p>',
329
title: 'Basic Table Cell',
330
html: '<p>Basic panel in a table cell.</p>',
331
cellId: 'basic-cell',
332
cellCls: 'custom-cls'
334
html: '<p>Plain panel</p>'
336
title: 'Another Cell',
337
html: '<p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p><br /><p>Row spanning.</p>',
341
html: 'Plain cell spanning two columns',
344
title: 'More Column Spanning',
345
html: '<p>Spanning three columns.</p>',
348
title: 'Spanning All Columns',
349
html: '<p>Spanning all columns.</p>',