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