source: trunk/web/addons/job_monarch/lib/extjs/docs/output/Ext.layout.CardLayout.html @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 11.4 KB
Line 
1        <div class="body-wrap">
2        <div class="top-tools">
3            <a class="inner-link" href="#Ext.layout.CardLayout-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
4            <a class="inner-link" href="#Ext.layout.CardLayout-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
5            <a class="inner-link" href="#Ext.layout.CardLayout-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
6                            <a class="inner-link" href="#Ext.layout.CardLayout-configs"><img src="../resources/images/default/s.gif" class="item-icon icon-config">Config Options</a>
7                        <a class="bookmark" href="../docs/?class=Ext.layout.CardLayout"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
8        </div>
9                <div class="inheritance res-block">
10<pre class="res-block-inner"><a ext:cls="Ext.layout.ContainerLayout" ext:member="" href="output/Ext.layout.ContainerLayout.html">ContainerLayout</a>
11  <img src="resources/elbow-end.gif"/><a ext:cls="Ext.layout.FitLayout" ext:member="" href="output/Ext.layout.FitLayout.html">FitLayout</a>
12    <img src="resources/elbow-end.gif"/>CardLayout</pre></div>
13                <h1>Class Ext.layout.CardLayout</h1>
14        <table cellspacing="0">
15            <tr><td class="label">Package:</td><td class="hd-info">Ext.layout</td></tr>
16            <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/CardLayout.js" target="_blank">CardLayout.js</a></td></tr>
17            <tr><td class="label">Class:</td><td class="hd-info">CardLayout</td></tr>
18                                    <tr><td class="label">Extends:</td><td class="hd-info"><a ext:cls="Ext.layout.FitLayout" ext:member="" href="output/Ext.layout.FitLayout.html">FitLayout</a></td></tr>
19                    </table>
20        <div class="description">
21            *
22<p>This layout contains multiple panels, each fit to the container, where only a single panel can be
23visible at any given time.  This layout style is most commonly used for wizards, tab implementations, etc.
24This class is intended to be extended or created via the layout:'card' <a ext:cls="Ext.Container" ext:member="layout" href="output/Ext.Container.html#layout">Ext.Container.layout</a> config,
25and should generally not need to be created directly via the new keyword.</p>
26<p>The CardLayout's focal method is <a ext:cls="Ext.layout.CardLayout" ext:member="setActiveItem" href="output/Ext.layout.CardLayout.html#setActiveItem">setActiveItem</a>.  Since only one panel is displayed at a time,
27the only way to move from one panel to the next is by calling setActiveItem, passing the id or index of
28the next panel to display.  The layout itself does not provide a mechanism for handling this navigation,
29so that functionality must be provided by the developer.</p>
30<p>In the following example, a simplistic wizard setup is demonstrated.  A button bar is added
31to the footer of the containing panel to provide navigation buttons.  The buttons will be handled by a
32common navigation routine -- for this example, the implementation of that routine has been ommitted since
33it can be any type of custom logic.  Note that other uses of a CardLayout (like a tab control) would require a
34completely different implementation.  For serious implementations, a better approach would be to extend
35CardLayout to provide the custom functionality needed.  Example usage:</p>
36<pre><code>var navHandler = <b>function</b>(direction){
37    <i>// This routine could contain business logic required to manage the navigation steps.</i>
38    <i>// It would call setActiveItem as needed, manage navigation button state, handle any</i>
39    <i>// branching logic that might be required, handle alternate actions like cancellation</i>
40    <i>// or finalization, etc.  A complete wizard implementation could get pretty</i>
41    <i>// sophisticated depending on the complexity required, and should probably be</i>
42    <i>// done as a subclass of CardLayout <b>in</b> a real-world implementation.</i>
43};
44
45<b>var</b> card = <b>new</b> Ext.Panel({
46    title: <em>'Example Wizard'</em>,
47    layout:<em>'card'</em>,
48    activeItem: 0, <i>// make sure the active item is set on the container config!</i>
49    bodyStyle: <em>'padding:15px'</em>,
50    defaults: {
51        <i>// applied to each contained panel</i>
52        border:false
53    },
54    <i>// just an example of one possible navigation scheme, using buttons</i>
55    bbar: [
56        {
57            id: <em>'move-prev'</em>,
58            text: <em>'Back'</em>,
59            handler: navHandler.createDelegate(<b>this</b>, [-1]),
60            disabled: true
61        },
62        <em>'->'</em>, <i>// greedy spacer so that the buttons are aligned to each side</i>
63        {
64            id: <em>'move-next'</em>,
65            text: <em>'Next'</em>,
66            handler: navHandler.createDelegate(<b>this</b>, [1])
67        }
68    ],
69    <i>// the panels (or <em>"cards"</em>) within the layout</i>
70    items: [{
71        id: <em>'card-0'</em>,
72        html: <em>'&lt;h1&gt;Welcome to the Wizard!&lt;/h1&gt;&lt;p&gt;Step 1 of 3&lt;/p&gt;'</em>
73    },{
74        id: <em>'card-1'</em>,
75        html: <em>'&lt;p&gt;Step 2 of 3&lt;/p&gt;'</em>
76    },{
77        id: <em>'card-2'</em>,
78        html: <em>'&lt;h1&gt;Congratulations!&lt;/h1&gt;&lt;p&gt;Step 3 of 3 - Complete&lt;/p&gt;'</em>
79    }]
80});</code></pre>        </div>
81       
82        <div class="hr"></div>
83                <a id="Ext.layout.CardLayout-configs"></a>
84        <h2>Config Options</h2>
85        <table cellspacing="0" class="member-table">
86            <tr>
87                <th class="sig-header" colspan="2">Config Options</th>
88                <th class="msource-header">Defined By</th>
89            </tr>
90                <tr class="config-row expandable">
91        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
92        <td class="sig">
93        <a id="Ext.layout.CardLayout-deferredRender"></a>
94            <b>deferredRender</b> : Boolean            <div class="mdesc">
95                        <div class="short">True to render each contained item at the time it becomes active, false to render all contained items as soon as the ...</div>
96            <div class="long">
97                True to render each contained item at the time it becomes active, false to render all contained items as soon as the layout is rendered (defaults to false). If there is a significant amount of content or a lot of heavy controls being rendered into panels that are not displayed by default, setting this to true might improve performance.            </div>
98                        </div>
99        </td>
100        <td class="msource">CardLayout</td>
101    </tr>
102        <tr class="config-row inherited alt expandable">
103        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
104        <td class="sig">
105        <a id="Ext.layout.CardLayout-extraCls"></a>
106            <b>extraCls</b> : String            <div class="mdesc">
107                        <div class="short">An optional extra CSS class that will be added to the container (defaults to ''). This can be useful for adding custo...</div>
108            <div class="long">
109                An optional extra CSS class that will be added to the container (defaults to ''). This can be useful for adding customized styles to the container or any of its children using standard CSS rules.            </div>
110                        </div>
111        </td>
112        <td class="msource"><a ext:cls="Ext.layout.ContainerLayout" ext:member="#extraCls" href="output/Ext.layout.ContainerLayout.html#extraCls">ContainerLayout</a></td>
113    </tr>
114        <tr class="config-row inherited">
115        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
116        <td class="sig">
117        <a id="Ext.layout.CardLayout-renderHidden"></a>
118            <b>renderHidden</b> : Boolean            <div class="mdesc">
119                            True to hide each contained item on render (defaults to false).                        </div>
120        </td>
121        <td class="msource"><a ext:cls="Ext.layout.ContainerLayout" ext:member="#renderHidden" href="output/Ext.layout.ContainerLayout.html#renderHidden">ContainerLayout</a></td>
122    </tr>
123            </table>
124                <a id="Ext.layout.CardLayout-props"></a>
125        <h2>Public Properties</h2>
126                <table cellspacing="0" class="member-table">
127            <tr>
128                <th class="sig-header" colspan="2">Property</th>
129                <th class="msource-header">Defined By</th>
130            </tr>
131                <tr class="property-row inherited expandable">
132        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
133        <td class="sig">
134        <a id="Ext.layout.CardLayout-activeItem"></a>
135            <b>activeItem</b> : Ext.Component            <div class="mdesc">
136                        <div class="short">
137A reference to the Ext.Component that is active.  For example,
138if(myPanel.layout.activeItem.id == 'item-1') { ... }....</div>
139            <div class="long">
140               
141A reference to the <a ext:cls="Ext.Component" href="output/Ext.Component.html">Ext.Component</a> that is active.  For example,
142if(myPanel.layout.activeItem.id == 'item-1') { ... }.  activeItem only applies to layout styles that can
143display items one at a time (like <a ext:cls="Ext.layout.Accordion" href="output/Ext.layout.Accordion.html">Ext.layout.Accordion</a>, <a ext:cls="Ext.layout.CardLayout" href="output/Ext.layout.CardLayout.html">Ext.layout.CardLayout</a>
144and <a ext:cls="Ext.layout.FitLayout" href="output/Ext.layout.FitLayout.html">Ext.layout.FitLayout</a>).  Read-only.  Related to <a ext:cls="Ext.Container" ext:member="activeItem" href="output/Ext.Container.html#activeItem">Ext.Container.activeItem</a>.            </div>
145                        </div>
146        </td>
147        <td class="msource"><a ext:cls="Ext.layout.ContainerLayout" ext:member="#activeItem" href="output/Ext.layout.ContainerLayout.html#activeItem">ContainerLayout</a></td>
148    </tr>
149            </table>
150                <a id="Ext.layout.CardLayout-methods"></a>
151        <h2>Public Methods</h2>
152                <table cellspacing="0" class="member-table">
153            <tr>
154                <th class="sig-header" colspan="2">Method</th>
155                <th class="msource-header">Defined By</th>
156            </tr>
157                <tr class="method-row expandable">
158        <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
159        <td class="sig">
160        <a id="Ext.layout.CardLayout-setActiveItem"></a>
161            <b>setActiveItem</b>(&nbsp;<code>String/Number item</code>&nbsp;) : void            <div class="mdesc">
162                        <div class="short">Sets the active (visible) item in the layout.</div>
163            <div class="long">
164                Sets the active (visible) item in the layout.    <div class="mdetail-params">
165        <strong>Parameters:</strong>
166        <ul><li><code>item</code> : String/Number<div class="sub-desc">The string component id or numeric index of the item to activate</div></li>        </ul>
167        <strong>Returns:</strong>
168        <ul>
169            <li><code>void</code></li>
170        </ul>
171    </div>
172                </div>
173                        </div>
174        </td>
175        <td class="msource">CardLayout</td>
176    </tr>
177            </table>
178                <a id="Ext.layout.CardLayout-events"></a>
179        <h2>Public Events</h2>
180        <div class="no-members">This class has no public events.</div>
181        </div>
Note: See TracBrowser for help on using the repository browser.