Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git] / docs / source / RowWrap.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5   <title>The source code</title>
6   <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7   <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8   <style type="text/css">
9     .highlight { display: block; background-color: #ddd; }
10   </style>
11   <script type="text/javascript">
12     function highlight() {
13       document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
14     }
15   </script>
16 </head>
17 <body onload="prettyPrint(); highlight();">
18   <pre class="prettyprint lang-js"><span id='Ext-grid-feature-RowWrap'>/**
19 </span> * @class Ext.grid.feature.RowWrap
20  * @extends Ext.grid.feature.Feature
21  * @private
22  */
23 Ext.define('Ext.grid.feature.RowWrap', {
24     extend: 'Ext.grid.feature.Feature',
25     alias: 'feature.rowwrap',
26
27     // turn off feature events.
28     hasFeatureEvent: false,
29     
30     mutateMetaRowTpl: function(metaRowTpl) {        
31         // Remove &quot;x-grid-row&quot; from the first row, note this could be wrong
32         // if some other feature unshifted things in front.
33         metaRowTpl[0] = metaRowTpl[0].replace(Ext.baseCSSPrefix + 'grid-row', '');
34         metaRowTpl[0] = metaRowTpl[0].replace(&quot;{[this.embedRowCls()]}&quot;, &quot;&quot;);
35         // 2
36         metaRowTpl.unshift('&lt;table class=&quot;' + Ext.baseCSSPrefix + 'grid-table ' + Ext.baseCSSPrefix + 'grid-table-resizer&quot; style=&quot;width: {[this.embedFullWidth()]}px;&quot;&gt;');
37         // 1
38         metaRowTpl.unshift('&lt;tr class=&quot;' + Ext.baseCSSPrefix + 'grid-row {[this.embedRowCls()]}&quot;&gt;&lt;td colspan=&quot;{[this.embedColSpan()]}&quot;&gt;&lt;div class=&quot;' + Ext.baseCSSPrefix + 'grid-rowwrap-div&quot;&gt;');
39         
40         // 3
41         metaRowTpl.push('&lt;/table&gt;');
42         // 4
43         metaRowTpl.push('&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;');
44     },
45     
46     embedColSpan: function() {
47         return '{colspan}';
48     },
49     
50     embedFullWidth: function() {
51         return '{fullWidth}';
52     },
53     
54     getAdditionalData: function(data, idx, record, orig) {
55         var headerCt = this.view.headerCt,
56             colspan  = headerCt.getColumnCount(),
57             fullWidth = headerCt.getFullWidth(),
58             items    = headerCt.query('gridcolumn'),
59             itemsLn  = items.length,
60             i = 0,
61             o = {
62                 colspan: colspan,
63                 fullWidth: fullWidth
64             },
65             id,
66             tdClsKey,
67             colResizerCls;
68
69         for (; i &lt; itemsLn; i++) {
70             id = items[i].id;
71             tdClsKey = id + '-tdCls';
72             colResizerCls = Ext.baseCSSPrefix + 'grid-col-resizer-'+id;
73             // give the inner td's the resizer class
74             // while maintaining anything a user may have injected via a custom
75             // renderer
76             o[tdClsKey] = colResizerCls + &quot; &quot; + (orig[tdClsKey] ? orig[tdClsKey] : '');
77             // TODO: Unhackify the initial rendering width's
78             o[id+'-tdAttr'] = &quot; style=\&quot;width: &quot; + (items[i].hidden ? 0 : items[i].getDesiredWidth()) + &quot;px;\&quot; &quot;/* + (i === 0 ? &quot; rowspan=\&quot;2\&quot;&quot; : &quot;&quot;)*/;
79             if (orig[id+'-tdAttr']) {
80                 o[id+'-tdAttr'] += orig[id+'-tdAttr'];
81             }
82             
83         }
84
85         return o;
86     },
87     
88     getMetaRowTplFragments: function() {
89         return {
90             embedFullWidth: this.embedFullWidth,
91             embedColSpan: this.embedColSpan
92         };
93     }
94     
95 });</pre>
96 </body>
97 </html>