Ext 树的节点

请问一下 EXT 的树节点,能不能把 ROOT 下面的 A,B 节点作为普通树节点 ,C 节点作为异步的树节点呢 ?
Google 了一下,N多的都是从 ROOT 就是 AnyscTreeNode .

3个回答

具体可以参考AsyncTreeNode.js的源码:关注其expand方法。
[code="javascript"]
expand : function(deep, anim, callback){
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);
}
}.createDelegate(this);
timer = setInterval(f, 200);
return;
}
if(!this.loaded){
if(this.fireEvent("beforeload", this) === false){
return;
}
this.loading = true;
this.ui.beforeLoad(this);

        [b]var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();[/b]
        if(loader){
            loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback]));
            return;
        }
    }
    Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback);
},

[/code][code="java"][/code]

目前不能这样。只能统一

可以的。C节点为AsyncTreeNode节点,配置其loader,指定url即可。Ext加载结点时先试图使用该节点本身的TreeLoader加载,如果没有则尝试使用TreePanel的整体TreeLoader加载数据。
[code="javascript"]
load
public function load( Ext.tree.TreeNode node, Function callback )
Load an Ext.tree.TreeNode from the URL specified in the constructor. This is called automatically when a node is expanded, but may be used to reload a node (or append new children if the clearOnLoad option is false.)
Parameters:
node : Ext.tree.TreeNode
callback : Function
Returns:
void
This method is defined by TreeLoader.
[/code]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问