commit extjs-2.2.1
[extjs.git] / docs / output / Ext.layout.TableLayout.html
1         <div class="body-wrap">
2         <div class="top-tools">
3             <a class="inner-link" href="#Ext.layout.TableLayout-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
4             <a class="inner-link" href="#Ext.layout.TableLayout-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
5             <a class="inner-link" href="#Ext.layout.TableLayout-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
6                             <a class="inner-link" href="#Ext.layout.TableLayout-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.TableLayout"><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"/>TableLayout</pre></div>
12                 <h1>Class Ext.layout.TableLayout</h1>
13         <table cellspacing="0">
14             <tr><td class="label">Package:</td><td class="hd-info">Ext.layout</td></tr>
15             <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/TableLayout.js" target="_blank">TableLayout.js</a></td></tr>
16             <tr><td class="label">Class:</td><td class="hd-info">TableLayout</td></tr>
17                                     <tr><td class="label">Extends:</td><td class="hd-info"><a ext:cls="Ext.layout.ContainerLayout" ext:member="" href="output/Ext.layout.ContainerLayout.html">ContainerLayout</a></td></tr>
18                     </table>
19         <div class="description">
20             *
21 <p>This layout allows you to easily render content into an HTML table.  The total number of columns can be
22 specified, and rowspan and colspan can be used to create complex layouts within the table.
23 This class is intended to be extended or created via the layout:'table' <a ext:cls="Ext.Container" ext:member="layout" href="output/Ext.Container.html#layout">Ext.Container.layout</a> config,
24 and should generally not need to be created directly via the new keyword.</p>
25 <p>Note that when creating a layout via config, the layout-specific config properties must be passed in via
26 the <a ext:cls="Ext.Container" ext:member="layoutConfig" href="output/Ext.Container.html#layoutConfig">Ext.Container.layoutConfig</a> object which will then be applied internally to the layout.  In the
27 case of TableLayout, the only valid layout config property is <a ext:cls="Ext.layout.TableLayout" ext:member="columns" href="output/Ext.layout.TableLayout.html#columns">columns</a>.  However, the items added to a
28 TableLayout can supply the following table-specific config properties:</p>
29 <ul>
30 <li><b>rowspan</b> Applied to the table cell containing the item.</li>
31 <li><b>colspan</b> Applied to the table cell containing the item.</li>
32 <li><b>cellId</b> An id applied to the table cell containing the item.</li>
33 <li><b>cellCls</b> A CSS class name added to the table cell containing the item.</li>
34 </ul>
35 <p>The basic concept of building up a TableLayout is conceptually very similar to building up a standard
36 HTML table.  You simply add each panel (or "cell") that you want to include along with any span attributes
37 specified as the special config properties of rowspan and colspan which work exactly like their HTML counterparts.
38 Rather than explicitly creating and nesting rows and columns as you would in HTML, you simply specify the
39 total column count in the layoutConfig and start adding panels in their natural order from left to right,
40 top to bottom.  The layout will automatically figure out, based on the column count, rowspans and colspans,
41 how to position each panel within the table.  Just like with HTML tables, your rowspans and colspans must add
42 up correctly in your overall layout or you'll end up with missing and/or extra cells!  Example usage:</p>
43 <pre><code><i>// This code will generate a layout table that is 3 columns by 2 rows</i>
44 <i>// <b>with</b> some spanning included.  The basic layout will be:</i>
45 <i>// +--------+-----------------+</i>
46 <i>// |   A    |   B             |</i>
47 <i>// |        |--------+--------|</i>
48 <i>// |        |   C    |   D    |</i>
49 <i>// +--------+--------+--------+</i>
50 <b>var</b> table = <b>new</b> Ext.Panel({
51     title: <em>'Table Layout'</em>,
52     layout:<em>'table'</em>,
53     defaults: {
54         <i>// applied to each contained panel</i>
55         bodyStyle:<em>'padding:20px'</em>
56     },
57     layoutConfig: {
58         <i>// The total column count must be specified here</i>
59         columns: 3
60     },
61     items: [{
62         html: <em>'&lt;p&gt;Cell A content&lt;/p&gt;'</em>,
63         rowspan: 2
64     },{
65         html: <em>'&lt;p&gt;Cell B content&lt;/p&gt;'</em>,
66         colspan: 2
67     },{
68         html: <em>'&lt;p&gt;Cell C content&lt;/p&gt;'</em>,
69         cellCls: <em>'highlight'</em>
70     },{
71         html: <em>'&lt;p&gt;Cell D content&lt;/p&gt;'</em>
72     }]
73 });</code></pre>        </div>
74         
75         <div class="hr"></div>
76                 <a id="Ext.layout.TableLayout-configs"></a>
77         <h2>Config Options</h2>
78         <table cellspacing="0" class="member-table">
79             <tr>
80                 <th class="sig-header" colspan="2">Config Options</th>
81                 <th class="msource-header">Defined By</th>
82             </tr>
83                 <tr class="config-row expandable">\r
84         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
85         <td class="sig">\r
86         <a id="Ext.layout.TableLayout-columns"></a>\r
87             <b>columns</b> : Number            <div class="mdesc">\r
88                         <div class="short">The total number of columns to create in the table for this layout. If not specified, all panels added to this layout...</div>\r
89             <div class="long">\r
90                 The total number of columns to create in the table for this layout. If not specified, all panels added to this layout will be rendered into a single row using a column per panel.            </div>\r
91                         </div>\r
92         </td>\r
93         <td class="msource">TableLayout</td>\r
94     </tr>\r
95         <tr class="config-row inherited alt expandable">\r
96         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
97         <td class="sig">\r
98         <a id="Ext.layout.TableLayout-extraCls"></a>\r
99             <b>extraCls</b> : String            <div class="mdesc">\r
100                         <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>\r
101             <div class="long">\r
102                 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>\r
103                         </div>\r
104         </td>\r
105         <td class="msource"><a ext:cls="Ext.layout.ContainerLayout" ext:member="#extraCls" href="output/Ext.layout.ContainerLayout.html#extraCls">ContainerLayout</a></td>\r
106     </tr>\r
107         <tr class="config-row inherited">\r
108         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
109         <td class="sig">\r
110         <a id="Ext.layout.TableLayout-renderHidden"></a>\r
111             <b>renderHidden</b> : Boolean            <div class="mdesc">\r
112                             True to hide each contained item on render (defaults to false).                        </div>\r
113         </td>\r
114         <td class="msource"><a ext:cls="Ext.layout.ContainerLayout" ext:member="#renderHidden" href="output/Ext.layout.ContainerLayout.html#renderHidden">ContainerLayout</a></td>\r
115     </tr>\r
116             </table>
117                 <a id="Ext.layout.TableLayout-props"></a>
118         <h2>Public Properties</h2>
119         <div class="no-members">This class has no public properties.</div>        <a id="Ext.layout.TableLayout-methods"></a>
120         <h2>Public Methods</h2>
121         <div class="no-members">This class has no public methods.</div>        <a id="Ext.layout.TableLayout-events"></a>
122         <h2>Public Events</h2>
123         <div class="no-members">This class has no public events.</div>
124         </div>