roojs-core.js
[roojs1] / Roo / TreePanel.js
1
2
3
4 /**
5  * @class Roo.TreePanel
6  * @extends Roo.ContentPanel
7  * @parent Roo.BorderLayout Roo.LayoutDialog builder
8  * Treepanel component
9  * 
10  * @constructor
11  * Create a new TreePanel. - defaults to fit/scoll contents.
12  * @param {String/Object} config A string to set only the panel's title, or a config object
13  */
14 Roo.TreePanel = function(config){
15     var el = config.el;
16     var tree = config.tree;
17     delete config.tree; 
18     delete config.el; // hopefull!
19     
20     // wrapper for IE7 strict & safari scroll issue
21     
22     var treeEl = el.createChild();
23     config.resizeEl = treeEl;
24     
25     
26     
27     Roo.TreePanel.superclass.constructor.call(this, el, config);
28  
29  
30     this.tree = new Roo.tree.TreePanel(treeEl , tree);
31     //console.log(tree);
32     this.on('activate', function()
33     {
34         if (this.tree.rendered) {
35             return;
36         }
37         //console.log('render tree');
38         this.tree.render();
39     });
40     // this should not be needed.. - it's actually the 'el' that resizes?
41     // actuall it breaks the containerScroll - dragging nodes auto scroll at top
42     
43     //this.on('resize',  function (cp, w, h) {
44     //        this.tree.innerCt.setWidth(w);
45     //        this.tree.innerCt.setHeight(h);
46     //        //this.tree.innerCt.setStyle('overflow-y', 'auto');
47     //});
48
49         
50     
51 };
52
53 Roo.extend(Roo.TreePanel, Roo.ContentPanel, {   
54     fitToFrame : true,
55     autoScroll : true,
56     /*
57      * @cfg {Roo.tree.TreePanel} tree [required] The tree TreePanel, with config etc.
58      */
59     tree : false
60
61 });