3
* Copyright(c) 2006-2008, Ext JS, LLC.
6
* http://extjs.com/license
10
* @class Ext.tree.AsyncTreeNode
11
* @extends Ext.tree.TreeNode
12
* @cfg {TreeLoader} loader A TreeLoader to be used by this node (defaults to the loader defined on the tree)
14
* @param {Object/String} attributes The attributes/config for the node or just a string with the text for the node
16
Ext.tree.AsyncTreeNode = function(config){
17
this.loaded = config && config.loaded === true;
19
Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments);
22
* Fires before this node is loaded, return false to cancel
23
* @param {Node} this This node
25
this.addEvents('beforeload', 'load');
28
* Fires when this node is loaded
29
* @param {Node} this This node
32
* The loader used by this node (defaults to using the tree's defined loader)
37
Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, {
38
expand : function(deep, anim, callback){
39
if(this.loading){ // if an async load is already running, waiting til it's done
42
if(!this.loading){ // done loading
44
this.expand(deep, anim, callback);
46
}.createDelegate(this);
47
timer = setInterval(f, 200);
51
if(this.fireEvent("beforeload", this) === false){
55
this.ui.beforeLoad(this);
56
var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();
58
loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback]));
62
Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback);
66
* Returns true if this node is currently loading
69
isLoading : function(){
73
loadComplete : function(deep, anim, callback){
76
this.ui.afterLoad(this);
77
this.fireEvent("load", this);
78
this.expand(deep, anim, callback);
82
* Returns true if this node has been loaded
85
isLoaded : function(){
89
hasChildNodes : function(){
90
if(!this.isLeaf() && !this.loaded){
93
return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);
98
* Trigger a reload for this node
99
* @param {Function} callback
101
reload : function(callback){
102
this.collapse(false, false);
103
while(this.firstChild){
104
this.removeChild(this.firstChild);
106
this.childrenRendered = false;
108
if(this.isHiddenRoot()){
109
this.expanded = false;
111
this.expand(false, false, callback);
115
Ext.tree.TreePanel.nodeTypes.async = Ext.tree.AsyncTreeNode;
b'\\ No newline at end of file'