X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775..6e39d509471fe9b4e2660e0d1631b350d0c66f40:/docs/source/TreeNode.html diff --git a/docs/source/TreeNode.html b/docs/source/TreeNode.html index 997f9102..c766ccb3 100644 --- a/docs/source/TreeNode.html +++ b/docs/source/TreeNode.html @@ -1,17 +1,12 @@ - - - The source code - - - - -
/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-
/** + + + + The source code + + + + +
/** * @class Ext.tree.TreeNode * @extends Ext.data.Node * @cfg {String} text The text for this node @@ -36,13 +31,13 @@ * @cfg {Boolean} draggable True to make this node draggable (defaults to false) * @cfg {Boolean} isTarget False to not allow this node to act as a drop target (defaults to true) * @cfg {Boolean} allowChildren False to not allow this node to have child nodes (defaults to true) - * @cfg {Boolean} editable False to not allow this node to be edited by an (@link Ext.tree.TreeEditor} (defaults to true) + * @cfg {Boolean} editable False to not allow this node to be edited by an {@link Ext.tree.TreeEditor} (defaults to true) * @constructor * @param {Object/String} attributes The attributes/config for the node or just a string with the text for the node */ Ext.tree.TreeNode = function(attributes){ attributes = attributes || {}; - if(typeof attributes == 'string'){ + if(Ext.isString(attributes)){ attributes = {text: attributes}; } this.childrenRendered = false; @@ -193,7 +188,7 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { getLoader : function(){ var owner; - return this.loader || ((owner = this.getOwnerTree()) && owner.loader ? owner.loader : new Ext.tree.TreeLoader()); + return this.loader || ((owner = this.getOwnerTree()) && owner.loader ? owner.loader : (this.loader = new Ext.tree.TreeLoader())); }, // private override @@ -235,11 +230,11 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { }, // private override - removeChild : function(node){ + removeChild : function(node, destroy){ this.ownerTree.getSelectionModel().unselect(node); Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments); // if it's been rendered remove dom node - if(this.childrenRendered){ + if(node.ui.rendered){ node.ui.remove(); } if(this.childNodes.length < 1){ @@ -272,8 +267,7 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { */ setText : function(text){ var oldText = this.text; - this.text = text; - this.attributes.text = text; + this.text = this.attributes.text = text; if(this.rendered){ // event without subscribing this.ui.onTextChange(this, text, oldText); } @@ -284,14 +278,21 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { * Triggers selection of this node */ select : function(){ - this.getOwnerTree().getSelectionModel().select(this); + var t = this.getOwnerTree(); + if(t){ + t.getSelectionModel().select(this); + } }, /** * Triggers deselection of this node + * @param {Boolean} silent (optional) True to stop selection change events from firing. */ - unselect : function(){ - this.getOwnerTree().getSelectionModel().unselect(this); + unselect : function(silent){ + var t = this.getOwnerTree(); + if(t){ + t.getSelectionModel().unselect(this, silent); + } }, /** @@ -299,7 +300,8 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { * @return {Boolean} */ isSelected : function(){ - return this.getOwnerTree().getSelectionModel().isSelected(this); + var t = this.getOwnerTree(); + return t ? t.getSelectionModel().isSelected(this) : false; }, /** @@ -309,7 +311,7 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { * @param {Function} callback (optional) A callback to be called when * expanding this node completes (does not wait for deep expand to complete). * Called with 1 parameter, this node. - * @param {Object} scope (optional) The scope in which to execute the callback. + * @param {Object} scope (optional) The scope (this reference) in which the callback is executed. Defaults to this TreeNode. */ expand : function(deep, anim, callback, scope){ if(!this.expanded){ @@ -359,7 +361,7 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { * @param {Function} callback (optional) A callback to be called when * expanding this node completes (does not wait for deep expand to complete). * Called with 1 parameter, this node. - * @param {Object} scope (optional) The scope in which to execute the callback. + * @param {Object} scope (optional) The scope (this reference) in which the callback is executed. Defaults to this TreeNode. */ collapse : function(deep, anim, callback, scope){ if(this.expanded && !this.isHiddenRoot()){ @@ -422,7 +424,7 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { * Ensures all parent nodes are expanded, and if necessary, scrolls * the node into view. * @param {Function} callback (optional) A function to call when the node has been made visible. - * @param {Object} scope (optional) The scope in which to execute the callback. + * @param {Object} scope (optional) The scope (this reference) in which the callback is executed. Defaults to this TreeNode. */ ensureVisible : function(callback, scope){ var tree = this.getOwnerTree(); @@ -540,15 +542,10 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { }, destroy : function(){ - if(this.childNodes){ - for(var i = 0,l = this.childNodes.length; i < l; i++){ - this.childNodes[i].destroy(); - } - this.childNodes = null; - } - if(this.ui.destroy){ - this.ui.destroy(); - } + this.unselect(true); + Ext.tree.TreeNode.superclass.destroy.call(this); + Ext.destroy(this.ui, this.loader); + this.ui = this.loader = null; }, // private @@ -557,6 +554,6 @@ Ext.extend(Ext.tree.TreeNode, Ext.data.Node, { } }); -Ext.tree.TreePanel.nodeTypes.node = Ext.tree.TreeNode;
- +Ext.tree.TreePanel.nodeTypes.node = Ext.tree.TreeNode;
+ \ No newline at end of file