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