Roo/tree/TreePanel.js
authorAlan Knowles <alan@roojs.com>
Wed, 2 Nov 2011 05:21:32 +0000 (13:21 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 2 Nov 2011 05:21:32 +0000 (13:21 +0800)
Roo/tree/TreePanel.js

index 8231d7d..1dd59bb 100644 (file)
@@ -31,7 +31,7 @@
  * @cfg {Boolean} singleExpand true if only 1 node per branch may be expanded
  * @cfg {Boolean} selModel A tree selection model to use with this TreePanel (defaults to a {@link Roo.tree.DefaultSelectionModel})
  * @cfg {Boolean} loader A TreeLoader for use with this TreePanel
- * @cfg {Roo.tree.TreeEditor} editor The TreeEditor to display when clicked.
+ * @cfg {Object|Roo.tree.TreeEditor} editor The TreeEditor or xtype data to display when clicked.
  * @cfg {String} pathSeparator The token used to separate sub-paths in path strings (defaults to '/')
  * @cfg {Function} renderer DEPRECATED - use TreeLoader:create event / Sets the rendering (formatting) function for the nodes. to return HTML markup for the tree view. The render function is called with  the following parameters:<ul><li>The {Object} The data for the node.</li></ul>
  * @cfg {Function} rendererTip DEPRECATED - use TreeLoader:create event / Sets the rendering (formatting) function for the nodes hovertip to return HTML markup for the tree view. The render function is called with  the following parameters:<ul><li>The {Object} The data for the node.</li></ul>
@@ -66,8 +66,8 @@ Roo.tree.TreePanel = function(el, config){
    /**
     * Read-only. The id of the container element becomes this TreePanel's id.
     */
-   this.id = this.el.id;
-   this.addEvents({
+    this.id = this.el.id;
+    this.addEvents({
         /**
         * @event beforeload
         * Fires before a node is loaded, return false to cancel
@@ -241,10 +241,15 @@ Roo.tree.TreePanel = function(el, config){
         */
        "nodedragover" : true
         
-   });
-   if(this.singleExpand){
+    });
+    if(this.singleExpand){
        this.on("beforeexpand", this.restrictExpand, this);
-   }
+    }
+    if (this.editor) {
+        this.editor.tree = this;
+        this.editor = Roo.factory(this.editor);
+    }
+   
 };
 Roo.extend(Roo.tree.TreePanel, Roo.data.Tree, {
     rootVisible : true,