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; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-tree-Column'>/**
19 </span> * @class Ext.tree.Column
20 * @extends Ext.grid.column.Column
22 * Provides indentation and folder structure markup for a Tree taking into account
23 * depth and position within the tree hierarchy.
27 Ext.define('Ext.tree.Column', {
28 extend: 'Ext.grid.column.Column',
29 alias: 'widget.treecolumn',
31 initComponent: function() {
32 var origRenderer = this.renderer || this.defaultRenderer,
33 origScope = this.scope || window;
35 this.renderer = function(value, metaData, record, rowIdx, colIdx, store, view) {
37 format = Ext.String.format,
38 depth = record.getDepth(),
39 treePrefix = Ext.baseCSSPrefix + 'tree-',
40 elbowPrefix = treePrefix + 'elbow-',
41 expanderCls = treePrefix + 'expander',
42 imgText = '<img src="{1}" class="{0}" />',
43 checkboxText= '<input type="button" role="checkbox" class="{0}" {1} />',
44 formattedValue = origRenderer.apply(origScope, arguments),
45 href = record.get('href'),
46 target = record.get('hrefTarget'),
47 cls = record.get('cls');
50 if (!record.isRoot() || (record.isRoot() && view.rootVisible)) {
51 if (record.getDepth() === depth) {
52 buf.unshift(format(imgText,
53 treePrefix + 'icon ' +
54 treePrefix + 'icon' + (record.get('icon') ? '-inline ' : (record.isLeaf() ? '-leaf ' : '-parent ')) +
55 (record.get('iconCls') || ''),
56 record.get('icon') || Ext.BLANK_IMAGE_URL
58 if (record.get('checked') !== null) {
61 (treePrefix + 'checkbox') + (record.get('checked') ? ' ' + treePrefix + 'checkbox-checked' : ''),
62 record.get('checked') ? 'aria-checked="true"' : ''
64 if (record.get('checked')) {
65 metaData.tdCls += (' ' + treePrefix + 'checked');
68 if (record.isLast()) {
69 if (record.isExpandable()) {
70 buf.unshift(format(imgText, (elbowPrefix + 'end-plus ' + expanderCls), Ext.BLANK_IMAGE_URL));
72 buf.unshift(format(imgText, (elbowPrefix + 'end'), Ext.BLANK_IMAGE_URL));
76 if (record.isExpandable()) {
77 buf.unshift(format(imgText, (elbowPrefix + 'plus ' + expanderCls), Ext.BLANK_IMAGE_URL));
79 buf.unshift(format(imgText, (treePrefix + 'elbow'), Ext.BLANK_IMAGE_URL));
83 if (record.isLast() || record.getDepth() === 0) {
84 buf.unshift(format(imgText, (elbowPrefix + 'empty'), Ext.BLANK_IMAGE_URL));
85 } else if (record.getDepth() !== 0) {
86 buf.unshift(format(imgText, (elbowPrefix + 'line'), Ext.BLANK_IMAGE_URL));
90 record = record.parentNode;
93 buf.push('<a href="', href, '" target="', target, '">', formattedValue, '</a>');
95 buf.push(formattedValue);
98 metaData.tdCls += ' ' + cls;
102 this.callParent(arguments);
105 defaultRenderer: function(value) {