PDA

View Full Version : Preload treepanel



Pmithrandir
10 Sep 2008, 5:16 AM
Hello
I have a Treepanel who have a loader.
The tree works nicely, but I want to limit my AJAX question and use a JSON variable to load the childrens of rootnode of my Tree.

I have make this code to create the Treepanel :


var treeNodes = new Array();
treeNodeValues.each(
function(nodeValue){
var node = new Ext.tree.TreeNode(nodeValue);
treeNodes.push(node);
}, this);
var racine = new Ext.tree.AsyncTreeNode({
text: 'Raccourcis',
draggable:false,
id:'source'
});
var Tree = Ext.tree;
var tree = new Tree.TreePanel({
el:'tree-div',
useArrows:true,
autoScroll:true,
rootVisible: false,
animate:true,
enableDD:true,
containerScroll: true,
onlyLeafCheckable: false,// all node have checkbox
root: racine,
loader: new Tree.TreeLoader({
baseParams:extractUrlParams(),
dataUrl:'AJAX/ACU_getTree.php',
baseAttrs: { uiProvider: Ext.tree.TreeCheckNodeUI } //add uiProvider attribute
})
});
tree.render();
racine.appendChild(treeNodes);


The problem is that a AJAX request is generate and all node is double.

If it is possible, i wan't to extend this preload system to all my composent (I have 5 panel + 1 tree panel).

Have you an idea to correct this system ?

An other problem is that with the same data, my Node object is correctly construct(with correct params) in loader, but not in the preload system. if you see an evident error ...

Thanks for your help

Pierre

10 Sep 2008, 5:20 AM
setup your root to have a 'children' property.

Pmithrandir
10 Sep 2008, 5:31 AM
I don't understand what you wan't me to make.
The property allowChildren is true by defaut.

I have perform the preload system and have my nodes (two times) in my tree, but my nodes have not all property(they are all leaf by exemple), i can't click and request the loader system...

There is no option in loader system to have the first item in params ?