1 //<Script type="text/javascript">
6 * Copyright(c) 2006-2007, Ext JS, LLC.
8 * Originally Released Under LGPL - original licence link has changed is not relivant.
11 * <script type="text/javascript">
16 * @class Roo.tree.ColumnTree
17 * @extends Roo.data.TreePanel
18 * @cfg {Object} columns Including width, header, renderer, cls, dataIndex
19 * @cfg {int} borderWidth compined right/left border allowance
21 * @param {String/HTMLElement/Element} el The container element
22 * @param {Object} config
24 Roo.tree.ColumnTree = function(el, config)
26 Roo.tree.ColumnTree.superclass.constructor.call(this, el , config);
30 * Fire this event on a container when it resizes
31 * @param {int} w Width
32 * @param {int} h Height
36 this.on('resize', this.onResize, this);
39 Roo.extend(Roo.tree.ColumnTree, Roo.tree.TreePanel, {
43 borderWidth: Roo.isBorderBox ? 0 : 2,
47 // add the header.....
49 Roo.tree.ColumnTree.superclass.render.apply(this);
51 this.el.addClass('x-column-tree');
53 this.headers = this.el.createChild(
54 {cls:'x-tree-headers'},this.innerCt.dom);
56 var cols = this.columns, c;
59 var len = cols.length;
60 for(var i = 0; i < len; i++){
62 totalWidth += c.width;
63 this.headEls.push(this.headers.createChild({
64 cls:'x-tree-hd ' + (c.cls?c.cls+'-hd':''),
69 style:'width:'+(c.width-this.borderWidth)+'px;'
72 this.headers.createChild({cls:'x-clear'});
73 // prevent floats from wrapping when clipped
74 this.headers.setWidth(totalWidth);
75 //this.innerCt.setWidth(totalWidth);
76 this.innerCt.setStyle({ overflow: 'auto' });
77 this.onResize(this.width, this.height);
81 onResize : function(w,h)
86 this.innerCt.setWidth(this.width);
87 this.innerCt.setHeight(this.height-20);
90 var cols = this.columns, c;
93 var len = cols.length;
94 for(var i = 0; i < len; i++){
96 if (this.autoExpandColumn !== false && c.dataIndex == this.autoExpandColumn) {
97 // it's the expander..
98 expEl = this.headEls[i];
101 totalWidth += c.width;
105 expEl.setWidth( ((w - totalWidth)-this.borderWidth - 20));
107 this.headers.setWidth(w-20);