3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>ExtJS Layout Examples</title>
\r
7 <!-- base library -->
\r
8 <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
\r
10 <!-- overrides to base library -->
\r
11 <link rel="stylesheet" type="text/css" href="../ux/css/CenterLayout.css" />
\r
13 <!-- page specific -->
\r
14 <link rel="stylesheet" type="text/css" href="layout-browser.css">
\r
16 <!-- ** Javascript ** -->
\r
17 <!-- ExtJS library: base/adapter -->
\r
18 <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
\r
20 <!-- ExtJS library: all widgets -->
\r
21 <script type="text/javascript" src="../../ext-all.js"></script>
\r
23 <!-- overrides to base library -->
\r
26 <script type="text/javascript" src="../ux/CenterLayout.js"></script>
\r
27 <script type="text/javascript" src="../ux/RowLayout.js"></script>
\r
29 <!-- page specific -->
\r
30 <script type="text/javascript" src="layouts/basic.js"></script>
\r
31 <script type="text/javascript" src="layouts/custom.js"></script>
\r
32 <script type="text/javascript" src="layouts/combination.js"></script>
\r
33 <script type="text/javascript" src="layout-browser.js"></script>
\r
37 <div id="header"><h1>Ext Layout Browser</h1></div>
\r
38 <div style="display:none;">
\r
40 <!-- Start page content -->
\r
41 <div id="start-div">
\r
42 <div style="float:left;" ><img src="images/layout-icon.gif" /></div>
\r
43 <div style="margin-left:100px;">
\r
45 <p>There are many sample layouts to choose from that should give you a good head start in building your own
\r
46 application layout. Just like the combination examples, you can mix and match most layouts as
\r
47 needed, so don't be afraid to experiment!</p>
\r
48 <p>Select a layout from the tree to the left to begin.</p>
\r
52 <!-- Basic layouts -->
\r
53 <div id="absolute-details">
\r
54 <h2>Ext.layout.AbsoluteLayout</h2>
\r
55 <p>This is a simple layout style that allows you to position items within a container using
\r
56 CSS-style absolute positioning via XY coordinates.</p>
\r
57 <p><b>Sample Config:</b></p>
\r
64 html: 'Positioned at x:50, y:50'
\r
67 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.AbsoluteLayout" target="_blank">API Reference</a></p>
\r
69 <div id="accordion-details">
\r
70 <h2>Ext.layout.Accordion</h2>
\r
71 <p>Displays one panel at a time in a stacked layout. No special config properties are required other
\r
72 than the layout — all panels added to the container will be converted to accordion panels.</p>
\r
73 <p><b>Sample Config:</b></p>
\r
75 layout: 'accordion',
\r
85 <p>You can easily customize individual accordion panels by adding styles scoped to the panel by class or id.
\r
86 For example, to style the panel with id 'panel2' above you could add rules like this:</p>
\r
88 #panel2 .x-panel-body {
\r
92 #panel2 .x-panel-header-text {
\r
96 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.Accordion" target="_blank">API Reference</a></p>
\r
98 <div id="anchor-details">
\r
99 <h2>Ext.layout.AnchorLayout</h2>
\r
100 <p>Provides anchoring of contained items to the container's edges. This type of layout is most commonly
\r
101 seen within FormPanels (or any container with a FormLayout) where fields are sized relative to the
\r
102 container without hard-coding their dimensions.</p>
\r
103 <p>In this example, panels are anchored for example purposes so that you can easily see the effect.
\r
104 If you resize the browser window, the anchored panels will automatically resize to maintain the
\r
105 same relative dimensions.</p>
\r
106 <p><b>Sample Config:</b></p>
\r
119 anchor: '-10, -262'
\r
122 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.AnchorLayout" target="_blank">API Reference</a></p>
\r
124 <div id="border-details">
\r
125 <h2>Ext.layout.BorderLayout</h2>
\r
126 <p>This Layout Browser page is already a border layout, and this example shows a separate border layout
\r
127 nested within a region of the page's border layout. Border layouts can be nested with just about any
\r
128 level of complexity that you might need.</p>
\r
129 <p>Every border layout <b>must</b> at least have a center region. All other regions are optional.</p>
\r
130 <p><b>Sample Config:</b></p>
\r
136 bodyStyle: 'padding:15px'
\r
144 cmargins: '5 0 0 0'
\r
146 title: 'Navigation',
\r
148 margins: '5 0 0 0',
\r
149 cmargins: '5 5 0 0',
\r
154 title: 'Main Content',
\r
155 collapsible: false,
\r
160 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.BorderLayout" target="_blank">API Reference</a></p>
\r
162 <div id="card-tabs-details">
\r
163 <h2>Ext.layout.CardLayout (TabPanel)</h2>
\r
164 <p>The TabPanel component is an excellent example of a sophisticated card layout. Each tab is just
\r
165 a panel managed by the card layout such that only one is visible at a time. In this case, configuration
\r
166 is simple since we aren't actually building a card layout from scratch. Don't forget to set the
\r
167 activeItem config in order to default to the tab that should display first.</p>
\r
168 <p><b>Sample Config:</b></p>
\r
171 activeItem: 0, // index or id
\r
174 html: 'This is tab 1 content.'
\r
177 html: 'This is tab 2 content.'
\r
180 html: 'This is tab 3 content.'
\r
183 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.CardLayout" target="_blank">CardLayout API Reference</a></p>
\r
184 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.TabPanel" target="_blank">TabPanel API Reference</a></p>
\r
186 <div id="card-wizard-details">
\r
187 <h2>Ext.layout.CardLayout (Wizard)</h2>
\r
188 <p>You can use a CardLayout to create your own custom wizard-style screen. The layout is a standard
\r
189 CardLayout with a Toolbar at the bottom, and the developer must supply the navigation function
\r
190 that implements the wizard's business logic (see the code in basic.js for details).</p>
\r
191 <p><b>Sample Config:</b></p>
\r
194 activeItem: 0, // index or id
\r
197 text: '&laquo; Previous'
\r
200 text: 'Next &raquo;'
\r
213 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.CardLayout" target="_blank">API Reference</a></p>
\r
215 <div id="column-details">
\r
216 <h2>Ext.layout.ColumnLayout</h2>
\r
217 <p>This is a useful layout style when you need multiple columns that can have varying content height.
\r
218 Any fixed-width column widths are calculated first, then any percentage-width columns specified using
\r
219 the <tt>columnWidth</tt> config will be calculated based on remaining container width. Percentages
\r
220 should add up to 1 (100%) in order to fill the container.</p>
\r
221 <p><b>Sample Config:</b></p>
\r
225 title: 'Width = 25%',
\r
229 title: 'Width = 75%',
\r
233 title: 'Width = 250px',
\r
238 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.ColumnLayout" target="_blank">API Reference</a></p>
\r
240 <div id="fit-details">
\r
241 <h2>Ext.layout.FitLayout</h2>
\r
242 <p>A very simple layout that simply fills the container with a single panel. This is usually the best default
\r
243 layout choice when you have no other specific layout requirements.</p>
\r
244 <p><b>Sample Config:</b></p>
\r
248 title: 'Fit Panel',
\r
253 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.FitLayout" target="_blank">API Reference</a></p>
\r
255 <div id="form-details">
\r
256 <h2>Ext.layout.FormLayout</h2>
\r
257 <p>FormLayout has specific logic to deal with form fields, labels, etc. While you can use a FormLayout in
\r
258 a standard panel, you will normally want to use a FormPanel directly in order to get form-specific functionality
\r
259 like validation, submission, etc. FormPanels use a FormLayout internally so the layout config is not needed
\r
260 (and the layout may not render correctly if overridden).</p>
\r
261 <p><b>Sample Config:</b></p>
\r
263 xtype: 'form', // FormPanel
\r
266 defaultType: 'textfield',
\r
268 fieldLabel: 'First Name',
\r
272 fieldLabel: 'Last Name',
\r
275 fieldLabel: 'Company',
\r
278 fieldLabel: 'Email',
\r
288 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.FormLayout" target="_blank">API Reference</a></p>
\r
290 <div id="table-details">
\r
291 <h2>Ext.layout.TableLayout</h2>
\r
292 <p>Outputs a standard HTML table as the layout container. This is sometimes useful for complex layouts
\r
293 where cell spanning is required, or when you want to allow the contents to flow naturally based on standard
\r
294 browser table layout rules.</p>
\r
295 <p><b>Sample Config:</b></p>
\r
302 {html:'1,1',rowspan:3},
\r
305 {html:'2,2',colspan:2},
\r
310 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.TableLayout" target="_blank">API Reference</a></p>
\r
313 <div id="vbox-details">
\r
314 <h2>Ext.layout.VBoxLayout</h2>
\r
315 <p>A layout that allows for the vertical and horizontal stretching of child items, much like the container
\r
316 layout with size management.</p>
\r
317 <p><b>Sample Config:</b></p>
\r
325 {html:'panel 1', flex:1},
\r
326 {html:'panel 2', height:150},
\r
327 {html:'panel 3', flex:2'}
\r
330 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.VBoxLayout" target="_blank">API Reference</a></p>
\r
333 <div id="hbox-details">
\r
334 <h2>Ext.layout.HBoxLayout</h2>
\r
335 <p>A layout that allows for the vertical and horizontal stretching of child items, much like the column
\r
336 layout but can stretch items vertically.</p>
\r
337 <p><b>Sample Config:</b></p>
\r
345 {html:'panel 1', flex:1},
\r
346 {html:'panel 2', width:150},
\r
347 {html:'panel 3', flex:2'}
\r
350 <p><a href="http://extjs.com/deploy/dev/docs/?class=Ext.layout.HBoxLayout" target="_blank">API Reference</a></p>
\r
354 <!-- Custom layouts -->
\r
355 <div id="row-details">
\r
356 <h2>Ext.ux.layout.RowLayout</h2>
\r
357 <p>This is a custom layout that is useful when you need a layout style with multiple rows of content.
\r
358 Any fixed-height rows are calculated first, then any percentage-height rows specified using the
\r
359 <tt>rowHeight</tt> config will be calculated based on remaining container height. Percentages
\r
360 should add up to 1 (100%) in order to fill the container. Standard panel widths (fixed or
\r
361 percentage) are also supported.</p>
\r
362 <p><b>Sample Config:</b></p>
\r
366 title: 'Height = 25%',
\r
370 title: 'Height = 100px',
\r
374 title: 'Height = 75%',
\r
379 <div id="center-details">
\r
380 <h2>Ext.ux.layout.CenterLayout</h2>
\r
381 <p>This is a custom layout for centering contents within a container. The only requirement is
\r
382 that the container have a single child panel with a width specified (fixed or percentage).
\r
383 The child panel can then contain any content, including other components, that will display
\r
384 centered within the main container. To make the centered panel non-visual, remove the title
\r
385 and add <tt>border:false</tt> to the child config.</p>
\r
386 <p><b>Sample Config:</b></p>
\r
388 layout:'ux.center',
\r
390 title: 'Centered Panel',
\r
392 html: 'Some content'
\r
398 <!-- Combination layouts -->
\r
399 <div id="tabs-nested-layouts-details">
\r
400 <h2>Tabs With Nested Layouts</h2>
\r
401 <p>There are multiple levels of layout nesting within three different TabPanels in this example.
\r
402 Each tab in a TabPanel can have its own separate layout. As we can see, some have plain content,
\r
403 while others contain full BorderLayouts. There is also a fully-loaded grid nested down inside
\r
404 the inner-most tab, showing that there is no limit to how complex your layout can be.</p>
\r
405 <p>One of the trickiest aspects of deeply nested layouts is dealing with borders on all the
\r
406 different panels used in the layout. In this example, body padding and region margins are used
\r
407 extensively to provide space between components so that borders can be displayed naturally in
\r
408 most cases. A different approach would be to minimize padding and use the config properties
\r
409 related to borders to turn borders on and off selectively to achieve a slightly different look
\r
412 <div id="complex-details">
\r
413 <h2>Complex Layout</h2>
\r
417 <!-- Form layouts -->
\r
418 <div id="abs-form-details">
\r
419 <h2>Absolute Layout Form</h2>
\r
420 <p>FormLayout supports absolute positioning in addition to standard anchoring for flexible control over
\r
421 positioning of fields and labels in containers. In this example, the top and left positions of the labels
\r
422 and fields are positioned absolute, while the field widths are anchored to the right and/or bottom of the container.</p>
\r