Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / source / Column3.html
diff --git a/docs/source/Column3.html b/docs/source/Column3.html
new file mode 100644 (file)
index 0000000..e759150
--- /dev/null
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <title>The source code</title>
+  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <style type="text/css">
+    .highlight { display: block; background-color: #ddd; }
+  </style>
+  <script type="text/javascript">
+    function highlight() {
+      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
+    }
+  </script>
+</head>
+<body onload="prettyPrint(); highlight();">
+  <pre class="prettyprint lang-js"><span id='Ext-tree-Column'>/**
+</span> * @class Ext.tree.Column
+ * @extends Ext.grid.column.Column
+ * 
+ * Provides indentation and folder structure markup for a Tree taking into account
+ * depth and position within the tree hierarchy.
+ * 
+ * @private
+ */
+Ext.define('Ext.tree.Column', {
+    extend: 'Ext.grid.column.Column',
+    alias: 'widget.treecolumn',
+
+    initComponent: function() {
+        var origRenderer = this.renderer || this.defaultRenderer,
+            origScope    = this.scope || window;
+
+        this.renderer = function(value, metaData, record, rowIdx, colIdx, store, view) {
+            var buf   = [],
+                format = Ext.String.format,
+                depth = record.getDepth(),
+                treePrefix  = Ext.baseCSSPrefix + 'tree-',
+                elbowPrefix = treePrefix + 'elbow-',
+                expanderCls = treePrefix + 'expander',
+                imgText     = '&lt;img src=&quot;{1}&quot; class=&quot;{0}&quot; /&gt;',
+                checkboxText= '&lt;input type=&quot;button&quot; role=&quot;checkbox&quot; class=&quot;{0}&quot; {1} /&gt;',
+                formattedValue = origRenderer.apply(origScope, arguments),
+                href = record.get('href'),
+                target = record.get('hrefTarget'),
+                cls = record.get('cls');
+
+            while (record) {
+                if (!record.isRoot() || (record.isRoot() &amp;&amp; view.rootVisible)) {
+                    if (record.getDepth() === depth) {
+                        buf.unshift(format(imgText,
+                            treePrefix + 'icon ' + 
+                            treePrefix + 'icon' + (record.get('icon') ? '-inline ' : (record.isLeaf() ? '-leaf ' : '-parent ')) +
+                            (record.get('iconCls') || ''),
+                            record.get('icon') || Ext.BLANK_IMAGE_URL
+                        ));
+                        if (record.get('checked') !== null) {
+                            buf.unshift(format(
+                                checkboxText,
+                                (treePrefix + 'checkbox') + (record.get('checked') ? ' ' + treePrefix + 'checkbox-checked' : ''),
+                                record.get('checked') ? 'aria-checked=&quot;true&quot;' : ''
+                            ));
+                            if (record.get('checked')) {
+                                metaData.tdCls += (' ' + Ext.baseCSSPrefix + 'tree-checked');
+                            }
+                        }
+                        if (record.isLast()) {
+                            if (record.isLeaf() || (record.isLoaded() &amp;&amp; !record.hasChildNodes())) {
+                                buf.unshift(format(imgText, (elbowPrefix + 'end'), Ext.BLANK_IMAGE_URL));
+                            } else {
+                                buf.unshift(format(imgText, (elbowPrefix + 'end-plus ' + expanderCls), Ext.BLANK_IMAGE_URL));
+                            }
+                            
+                        } else {
+                            if (record.isLeaf() || (record.isLoaded() &amp;&amp; !record.hasChildNodes())) {
+                                buf.unshift(format(imgText, (treePrefix + 'elbow'), Ext.BLANK_IMAGE_URL));
+                            } else {
+                                buf.unshift(format(imgText, (elbowPrefix + 'plus ' + expanderCls), Ext.BLANK_IMAGE_URL));
+                            }
+                        }
+                    } else {
+                        if (record.isLast() || record.getDepth() === 0) {
+                            buf.unshift(format(imgText, (elbowPrefix + 'empty'), Ext.BLANK_IMAGE_URL));
+                        } else if (record.getDepth() !== 0) {
+                            buf.unshift(format(imgText, (elbowPrefix + 'line'), Ext.BLANK_IMAGE_URL));
+                        }                      
+                    }
+                }
+                record = record.parentNode;
+            }
+            if (href) {
+                formattedValue = format('&lt;a href=&quot;{0}&quot; target=&quot;{1}&quot;&gt;{2}&lt;/a&gt;', href, target, formattedValue);
+            }
+            if (cls) {
+                metaData.tdCls += ' ' + cls;
+            }
+            return buf.join(&quot;&quot;) + formattedValue;
+        };
+        this.callParent(arguments);
+    },
+
+    defaultRenderer: function(value) {
+        return value;
+    }
+});</pre>
+</body>
+</html>