3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
15 Ext.ns('Ext.ux.tree');
18 * @class Ext.ux.tree.ColumnTree
19 * @extends Ext.tree.TreePanel
23 Ext.ux.tree.ColumnTree = Ext.extend(Ext.tree.TreePanel, {
25 borderWidth : Ext.isBorderBox ? 0 : 2, // the combined left/right border for each cell
26 cls : 'x-column-tree',
28 onRender : function(){
29 Ext.tree.ColumnTree.superclass.onRender.apply(this, arguments);
30 this.headers = this.header.createChild({cls:'x-tree-headers'});
32 var cols = this.columns, c;
34 var scrollOffset = 19; // similar to Ext.grid.GridView default
36 for(var i = 0, len = cols.length; i < len; i++){
38 totalWidth += c.width;
39 this.headers.createChild({
40 cls:'x-tree-hd ' + (c.cls?c.cls+'-hd':''),
45 style:'width:'+(c.width-this.borderWidth)+'px;'
48 this.headers.createChild({cls:'x-clear'});
49 // prevent floats from wrapping when clipped
50 this.headers.setWidth(totalWidth+scrollOffset);
51 this.innerCt.setWidth(totalWidth);
55 Ext.reg('columntree', Ext.ux.tree.ColumnTree);
58 Ext.tree.ColumnTree = Ext.ux.tree.ColumnTree;
62 * @class Ext.ux.tree.ColumnNodeUI
63 * @extends Ext.tree.TreeNodeUI
65 Ext.ux.tree.ColumnNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
66 focus: Ext.emptyFn, // prevent odd scrolling behavior
68 renderElements : function(n, a, targetNode, bulkRender){
69 this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
71 var t = n.getOwnerTree();
73 var bw = t.borderWidth;
77 '<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf ', a.cls,'">',
78 '<div class="x-tree-col" style="width:',c.width-bw,'px;">',
79 '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",
80 '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow">',
81 '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on">',
82 '<a hidefocus="on" class="x-tree-node-anchor" href="',a.href ? a.href : "#",'" tabIndex="1" ',
83 a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '>',
84 '<span unselectable="on">', n.text || (c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</span></a>",
86 for(var i = 1, len = cols.length; i < len; i++){
89 buf.push('<div class="x-tree-col ',(c.cls?c.cls:''),'" style="width:',c.width-bw,'px;">',
90 '<div class="x-tree-col-text">',(c.renderer ? c.renderer(a[c.dataIndex], n, a) : a[c.dataIndex]),"</div>",
94 '<div class="x-clear"></div></div>',
95 '<ul class="x-tree-node-ct" style="display:none;"></ul>',
98 if(bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()){
99 this.wrap = Ext.DomHelper.insertHtml("beforeBegin",
100 n.nextSibling.ui.getEl(), buf.join(""));
102 this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join(""));
105 this.elNode = this.wrap.childNodes[0];
106 this.ctNode = this.wrap.childNodes[1];
107 var cs = this.elNode.firstChild.childNodes;
108 this.indentNode = cs[0];
110 this.iconNode = cs[2];
112 this.textNode = cs[3].firstChild;
117 Ext.tree.ColumnNodeUI = Ext.ux.tree.ColumnNodeUI;