123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <div class="body-wrap">
- <div class="top-tools">
- <a class="inner-link" href="#Ext.layout.CardLayout-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
- <a class="inner-link" href="#Ext.layout.CardLayout-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
- <a class="inner-link" href="#Ext.layout.CardLayout-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
- <a class="inner-link" href="#Ext.layout.CardLayout-configs"><img src="../resources/images/default/s.gif" class="item-icon icon-config">Config Options</a>
- <a class="bookmark" href="../docs/?class=Ext.layout.CardLayout"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
- </div>
- <div class="inheritance res-block">
- <pre class="res-block-inner"><a ext:cls="Ext.layout.ContainerLayout" ext:member="" href="output/Ext.layout.ContainerLayout.html">ContainerLayout</a>
- <img src="resources/elbow-end.gif"/><a ext:cls="Ext.layout.FitLayout" ext:member="" href="output/Ext.layout.FitLayout.html">FitLayout</a>
- <img src="resources/elbow-end.gif"/>CardLayout</pre></div>
- <h1>Class Ext.layout.CardLayout</h1>
- <table cellspacing="0">
- <tr><td class="label">Package:</td><td class="hd-info">Ext.layout</td></tr>
- <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/CardLayout.js" target="_blank">CardLayout.js</a></td></tr>
- <tr><td class="label">Class:</td><td class="hd-info">CardLayout</td></tr>
- <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>
- </table>
- <div class="description">
- <p>This layout contains multiple panels, each fit to the container, where only a single panel can be
- visible at any given time. This layout style is most commonly used for wizards, tab implementations, etc.
- This 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,
- and should generally not need to be created directly via the new keyword.</p>
- <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,
- the only way to move from one panel to the next is by calling setActiveItem, passing the id or index of
- the next panel to display. The layout itself does not provide a mechanism for handling this navigation,
- so that functionality must be provided by the developer.</p>
- <p>In the following example, a simplistic wizard setup is demonstrated. A button bar is added
- to the footer of the containing panel to provide navigation buttons. The buttons will be handled by a
- common navigation routine -- for this example, the implementation of that routine has been ommitted since
- it can be any type of custom logic. Note that other uses of a CardLayout (like a tab control) would require a
- completely different implementation. For serious implementations, a better approach would be to extend
- CardLayout to provide the custom functionality needed. Example usage:</p>
- <pre><code>var navHandler = <b>function</b>(direction){
- <i>// This routine could contain business logic required to manage the navigation steps.</i>
- <i>// It would call setActiveItem as needed, manage navigation button state, handle any</i>
- <i>// branching logic that might be required, handle alternate actions like cancellation</i>
- <i>// or finalization, etc. A complete wizard implementation could get pretty</i>
- <i>// sophisticated depending on the complexity required, and should probably be</i>
- <i>// done as a subclass of CardLayout <b>in</b> a real-world implementation.</i>
- };
- <b>var</b> card = <b>new</b> Ext.Panel({
- title: <em>'Example Wizard'</em>,
- layout:<em>'card'</em>,
- activeItem: 0, <i>// make sure the active item is set on the container config!</i>
- bodyStyle: <em>'padding:15px'</em>,
- defaults: {
- <i>// applied to each contained panel</i>
- border:false
- },
- <i>// just an example of one possible navigation scheme, using buttons</i>
- bbar: [
- {
- id: <em>'move-prev'</em>,
- text: <em>'Back'</em>,
- handler: navHandler.createDelegate(<b>this</b>, [-1]),
- disabled: true
- },
- <em>'->'</em>, <i>// greedy spacer so that the buttons are aligned to each side</i>
- {
- id: <em>'move-next'</em>,
- text: <em>'Next'</em>,
- handler: navHandler.createDelegate(<b>this</b>, [1])
- }
- ],
- <i>// the panels (or <em>"cards"</em>) within the layout</i>
- items: [{
- id: <em>'card-0'</em>,
- html: <em>'<h1>Welcome to the Wizard!</h1><p>Step 1 of 3</p>'</em>
- },{
- id: <em>'card-1'</em>,
- html: <em>'<p>Step 2 of 3</p>'</em>
- },{
- id: <em>'card-2'</em>,
- html: <em>'<h1>Congratulations!</h1><p>Step 3 of 3 - Complete</p>'</em>
- }]
- });</code></pre> </div>
-
- <div class="hr"></div>
- <a id="Ext.layout.CardLayout-configs"></a>
- <h2>Config Options</h2>
- <table cellspacing="0" class="member-table">
- <tr>
- <th class="sig-header" colspan="2">Config Options</th>
- <th class="msource-header">Defined By</th>
- </tr>
- <tr class="config-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.layout.CardLayout-deferredRender"></a>
- <b>deferredRender</b> : Boolean <div class="mdesc">
- <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>
- <div class="long">
- 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>
- </div>
- </td>
- <td class="msource">CardLayout</td>
- </tr>
- <tr class="config-row inherited alt expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.layout.CardLayout-extraCls"></a>
- <b>extraCls</b> : String <div class="mdesc">
- <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>
- <div class="long">
- 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>
- </div>
- </td>
- <td class="msource"><a ext:cls="Ext.layout.ContainerLayout" ext:member="#extraCls" href="output/Ext.layout.ContainerLayout.html#extraCls">ContainerLayout</a></td>
- </tr>
- <tr class="config-row inherited">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.layout.CardLayout-renderHidden"></a>
- <b>renderHidden</b> : Boolean <div class="mdesc">
- True to hide each contained item on render (defaults to false). </div>
- </td>
- <td class="msource"><a ext:cls="Ext.layout.ContainerLayout" ext:member="#renderHidden" href="output/Ext.layout.ContainerLayout.html#renderHidden">ContainerLayout</a></td>
- </tr>
- </table>
- <a id="Ext.layout.CardLayout-props"></a>
- <h2>Public Properties</h2>
- <table cellspacing="0" class="member-table">
- <tr>
- <th class="sig-header" colspan="2">Property</th>
- <th class="msource-header">Defined By</th>
- </tr>
- <tr class="property-row inherited expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.layout.CardLayout-activeItem"></a>
- <b>activeItem</b> : Ext.Component <div class="mdesc">
- <div class="short">
- A reference to the Ext.Component that is active. For example,
- if(myPanel.layout.activeItem.id == 'item-1') { ... }....</div>
- <div class="long">
-
- A reference to the <a ext:cls="Ext.Component" href="output/Ext.Component.html">Ext.Component</a> that is active. For example,
- if(myPanel.layout.activeItem.id == 'item-1') { ... }. activeItem only applies to layout styles that can
- display 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>
- and <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>
- </div>
- </td>
- <td class="msource"><a ext:cls="Ext.layout.ContainerLayout" ext:member="#activeItem" href="output/Ext.layout.ContainerLayout.html#activeItem">ContainerLayout</a></td>
- </tr>
- </table>
- <a id="Ext.layout.CardLayout-methods"></a>
- <h2>Public Methods</h2>
- <table cellspacing="0" class="member-table">
- <tr>
- <th class="sig-header" colspan="2">Method</th>
- <th class="msource-header">Defined By</th>
- </tr>
- <tr class="method-row expandable">
- <td class="micon"><a class="exi" href="#expand"> </a></td>
- <td class="sig">
- <a id="Ext.layout.CardLayout-setActiveItem"></a>
- <b>setActiveItem</b>( <code>String/Number item</code> ) : void <div class="mdesc">
- <div class="short">Sets the active (visible) item in the layout.</div>
- <div class="long">
- Sets the active (visible) item in the layout. <div class="mdetail-params">
- <strong>Parameters:</strong>
- <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>
- <strong>Returns:</strong>
- <ul>
- <li><code>void</code></li>
- </ul>
- </div>
- </div>
- </div>
- </td>
- <td class="msource">CardLayout</td>
- </tr>
- </table>
- <a id="Ext.layout.CardLayout-events"></a>
- <h2>Public Events</h2>
- <div class="no-members">This class has no public events.</div>
- </div>
|