Upgrade to ExtJS 3.3.1 - Released 11/30/2010
[extjs.git] / docs / source / AsyncTreeNode.html
index 858e761..d762d9e 100644 (file)
-<html>\r
-<head>\r
-  <title>The source code</title>\r
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body  onload="prettyPrint();">\r
-    <pre class="prettyprint lang-js"><div id="cls-Ext.tree.AsyncTreeNode"></div>/**\r
- * @class Ext.tree.AsyncTreeNode\r
- * @extends Ext.tree.TreeNode\r
- * @cfg {TreeLoader} loader A TreeLoader to be used by this node (defaults to the loader defined on the tree)\r
- * @constructor\r
- * @param {Object/String} attributes The attributes/config for the node or just a string with the text for the node \r
- */\r
- Ext.tree.AsyncTreeNode = function(config){\r
-    this.loaded = config && config.loaded === true;\r
-    this.loading = false;\r
-    Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments);\r
-    /**\r
-    * @event beforeload\r
-    * Fires before this node is loaded, return false to cancel\r
-    * @param {Node} this This node\r
-    */\r
-    this.addEvents('beforeload', 'load');\r
-    /**\r
-    * @event load\r
-    * Fires when this node is loaded\r
-    * @param {Node} this This node\r
-    */\r
-    /**\r
-     * The loader used by this node (defaults to using the tree's defined loader)\r
-     * @type TreeLoader\r
-     * @property loader\r
-     */\r
-};\r
-Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, {\r
-    expand : function(deep, anim, callback, scope){\r
-        if(this.loading){ // if an async load is already running, waiting til it's done\r
-            var timer;\r
-            var f = function(){\r
-                if(!this.loading){ // done loading\r
-                    clearInterval(timer);\r
-                    this.expand(deep, anim, callback, scope);\r
-                }\r
-            }.createDelegate(this);\r
-            timer = setInterval(f, 200);\r
-            return;\r
-        }\r
-        if(!this.loaded){\r
-            if(this.fireEvent("beforeload", this) === false){\r
-                return;\r
-            }\r
-            this.loading = true;\r
-            this.ui.beforeLoad(this);\r
-            var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();\r
-            if(loader){\r
-                loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback, scope]), this);\r
-                return;\r
-            }\r
-        }\r
-        Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback, scope);\r
-    },\r
-    \r
-    /**\r
-     * Returns true if this node is currently loading\r
-     * @return {Boolean}\r
-     */\r
-    isLoading : function(){\r
-        return this.loading;  \r
-    },\r
-    \r
-    loadComplete : function(deep, anim, callback, scope){\r
-        this.loading = false;\r
-        this.loaded = true;\r
-        this.ui.afterLoad(this);\r
-        this.fireEvent("load", this);\r
-        this.expand(deep, anim, callback, scope);\r
-    },\r
-    \r
-    /**\r
-     * Returns true if this node has been loaded\r
-     * @return {Boolean}\r
-     */\r
-    isLoaded : function(){\r
-        return this.loaded;\r
-    },\r
-    \r
-    hasChildNodes : function(){\r
-        if(!this.isLeaf() && !this.loaded){\r
-            return true;\r
-        }else{\r
-            return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);\r
-        }\r
-    },\r
-\r
-    /**\r
-     * Trigger a reload for this node\r
-     * @param {Function} callback\r
-     * @param {Object} scope (optional) The scope in which to execute the callback.\r
-     */\r
-    reload : function(callback, scope){\r
-        this.collapse(false, false);\r
-        while(this.firstChild){\r
-            this.removeChild(this.firstChild).destroy();\r
-        }\r
-        this.childrenRendered = false;\r
-        this.loaded = false;\r
-        if(this.isHiddenRoot()){\r
-            this.expanded = false;\r
-        }\r
-        this.expand(false, false, callback, scope);\r
-    }\r
-});\r
-\r
-Ext.tree.TreePanel.nodeTypes.async = Ext.tree.AsyncTreeNode;</pre>    \r
-</body>\r
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
+  <title>The source code</title>
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body  onload="prettyPrint();">
+    <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.3.1
+ * Copyright(c) 2006-2010 Sencha Inc.
+ * licensing@sencha.com
+ * http://www.sencha.com/license
+ */
+<div id="cls-Ext.tree.AsyncTreeNode"></div>/**
+ * @class Ext.tree.AsyncTreeNode
+ * @extends Ext.tree.TreeNode
+ * @cfg {TreeLoader} loader A TreeLoader to be used by this node (defaults to the loader defined on the tree)
+ * @constructor
+ * @param {Object/String} attributes The attributes/config for the node or just a string with the text for the node 
+ */
+ Ext.tree.AsyncTreeNode = function(config){
+    this.loaded = config && config.loaded === true;
+    this.loading = false;
+    Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments);
+    /**
+    * @event beforeload
+    * Fires before this node is loaded, return false to cancel
+    * @param {Node} this This node
+    */
+    this.addEvents('beforeload', 'load');
+    /**
+    * @event load
+    * Fires when this node is loaded
+    * @param {Node} this This node
+    */
+    /**
+     * The loader used by this node (defaults to using the tree's defined loader)
+     * @type TreeLoader
+     * @property loader
+     */
+};
+Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, {
+    expand : function(deep, anim, callback, scope){
+        if(this.loading){ // if an async load is already running, waiting til it's done
+            var timer;
+            var f = function(){
+                if(!this.loading){ // done loading
+                    clearInterval(timer);
+                    this.expand(deep, anim, callback, scope);
+                }
+            }.createDelegate(this);
+            timer = setInterval(f, 200);
+            return;
+        }
+        if(!this.loaded){
+            if(this.fireEvent("beforeload", this) === false){
+                return;
+            }
+            this.loading = true;
+            this.ui.beforeLoad(this);
+            var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();
+            if(loader){
+                loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback, scope]), this);
+                return;
+            }
+        }
+        Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback, scope);
+    },
+    
+    /**
+     * Returns true if this node is currently loading
+     * @return {Boolean}
+     */
+    isLoading : function(){
+        return this.loading;  
+    },
+    
+    loadComplete : function(deep, anim, callback, scope){
+        this.loading = false;
+        this.loaded = true;
+        this.ui.afterLoad(this);
+        this.fireEvent("load", this);
+        this.expand(deep, anim, callback, scope);
+    },
+    
+    /**
+     * Returns true if this node has been loaded
+     * @return {Boolean}
+     */
+    isLoaded : function(){
+        return this.loaded;
+    },
+    
+    hasChildNodes : function(){
+        if(!this.isLeaf() && !this.loaded){
+            return true;
+        }else{
+            return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);
+        }
+    },
+
+    /**
+     * Trigger a reload for this node
+     * @param {Function} callback
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the callback is executed. Defaults to this Node.
+     */
+    reload : function(callback, scope){
+        this.collapse(false, false);
+        while(this.firstChild){
+            this.removeChild(this.firstChild).destroy();
+        }
+        this.childrenRendered = false;
+        this.loaded = false;
+        if(this.isHiddenRoot()){
+            this.expanded = false;
+        }
+        this.expand(false, false, callback, scope);
+    }
+});
+
+Ext.tree.TreePanel.nodeTypes.async = Ext.tree.AsyncTreeNode;</pre>    
+</body>
 </html>
\ No newline at end of file