hyankov
28 Jun 2007, 6:07 PM
Hello guys, I need some help.
I have a TreePanel, with a TreeLoader and a root node of AsyncTreeNode type. The dataUrl is returning me json. In other words:
var packagesTree = new Ext.tree.TreePanel('packages_Tree', {
animate:true,
loader: new Ext.tree.TreeLoader({dataUrl: packages_jsonTreeUrl}),
enableDD:true,
containerScroll: true,
rootVisible: false
});
if (packages_sortTree){
new Ext.tree.TreeSorter(packagesTree, {folderSort:true});
}
// set the root node
var root = new Ext.tree.AsyncTreeNode({
text: 'root',
draggable: false,
id: 'source'
});
packagesTree.setRootNode(root);
// render the tree
packagesTree.render();
Now, when I load the tree from a xml I have control over how each and single TreeNode is rendered. For example, I can check if the xml node has specific attribute and depending on it I can render the TreeNode one way or another. I don't see how this is done with json.
Here is my problem. Let's say my json returns the following format:
[
{"id":"xxx","text":"xxx","Type":"xxx","Active":true|false,"Version:"xxx"},
{"id":"xxx","text":"xxx","Type":"xxx","Active":true|false,"Version:"xxx"}
...
]
How do I intercept each (not only the children of the root) TreeNode render event for this tree, so I can control the way it's rendered, depending on my custom attributes or other factors? Somebody mentioned the event 'beforerender', but I can't figure out which control fires it.
Preferably I'd like to have control over the creation itself of the TreeNode, so I can specify config values. Is this possible?
Any help is appreciated!
I have a TreePanel, with a TreeLoader and a root node of AsyncTreeNode type. The dataUrl is returning me json. In other words:
var packagesTree = new Ext.tree.TreePanel('packages_Tree', {
animate:true,
loader: new Ext.tree.TreeLoader({dataUrl: packages_jsonTreeUrl}),
enableDD:true,
containerScroll: true,
rootVisible: false
});
if (packages_sortTree){
new Ext.tree.TreeSorter(packagesTree, {folderSort:true});
}
// set the root node
var root = new Ext.tree.AsyncTreeNode({
text: 'root',
draggable: false,
id: 'source'
});
packagesTree.setRootNode(root);
// render the tree
packagesTree.render();
Now, when I load the tree from a xml I have control over how each and single TreeNode is rendered. For example, I can check if the xml node has specific attribute and depending on it I can render the TreeNode one way or another. I don't see how this is done with json.
Here is my problem. Let's say my json returns the following format:
[
{"id":"xxx","text":"xxx","Type":"xxx","Active":true|false,"Version:"xxx"},
{"id":"xxx","text":"xxx","Type":"xxx","Active":true|false,"Version:"xxx"}
...
]
How do I intercept each (not only the children of the root) TreeNode render event for this tree, so I can control the way it's rendered, depending on my custom attributes or other factors? Somebody mentioned the event 'beforerender', but I can't figure out which control fires it.
Preferably I'd like to have control over the creation itself of the TreeNode, so I can specify config values. Is this possible?
Any help is appreciated!