PDA

View Full Version : how do i know, my treeloader is finished job?



dn2965
6 Oct 2009, 1:48 AM
(Ext.ux.tree.XmlTreeLoader (http://www.extjs.com/deploy/dev/examples/tree/xml-tree-loader.html))...



Ext.dd.Tree = new Ext.tree.TreePanel({
useArrows: true,
autoScroll: false,
containerScroll: true,
autoHeight: true,//required
rootVisible: false,
animate: false,
expanded:true,
border: false,
id: 'dnTreePanel'
,root: new Ext.tree.AsyncTreeNode({
text: 'Tree Root',
id: 'root'
})
,loader: new Ext.app.BookLoader({
dataUrl:'http://localhost/myphp/xq/treeNode.php'


})

});


i am useing a XmlTreeLoader, but i want to do something ,"after" the my tree is loaded,and expanded finish, how do i know , please

i think , it is about how to controll loader action problem, someone can give me a hand?
i tried use an ajax call to do presend then complete , but it is not work.. (bad way)

duncan

Condor
6 Oct 2009, 2:48 AM
A TreePanel doesn't have an expanded config option.

You should expand the root node manually, e.g.

treePanel.getRootNode.expand(true, null, function(){
// tree is now fully expanded
});

dn2965
6 Oct 2009, 7:19 AM
yes, i see .

but my question is
when after load data,treepanel 's loader>>
does it has a event to fire like afterload,doesn't it. ?

Condor
6 Oct 2009, 7:37 AM
The tree fires a 'load' event, but this will fire for every node that is expanded!

dn2965
6 Oct 2009, 7:39 AM
<?xml version="1.0" encoding="UTF-8"?>
<result text="aa(0000a)" leaf="false" id2="1B011P003.jpg">

<book text="a(0071)" leaf="false" id2="1B011P1a04.jpg"/>
<book text="b(0071)" leaf="false" id2="1B011P10b4.jpg"/>
<book text="c(0071)" leaf="false" id2="1B011P10c4.jpg">
<book text="d(0071)" leaf="false" id2="1B011P1d04.jpg">
<children text="e(0071)" leaf="false" id2="1B011Pe104.jpg">
<children text="f(0071)" leaf="false" id2="1B011Pf104.jpg"/>
</children>
</book>
</book>
</result>


above xml is my example , i don't know why i set
leaf="false" but , the node still display it is a leaf in my tree ? why

i tried



Ext.app.BookLoader = Ext.extend(Ext.ux.tree.XmlTreeLoader, {
processAttributes : function(attr){
if(attr.leaf){
if(attr.leaf=="false")
attr.leaf= false ;
else attr.leaf= true ;
}
}
});