PDA

View Full Version : TreePanel and XmlTreeLoader workflow



droesler
6 Aug 2009, 12:46 PM
I have the following...



var globalVar;

var myTreeLoader = new Ext.ux.tree.XmlTreeLoader( {
dataUrl: 'urlToData.pl',
baseParams: {param: ''}
}
);

myTreeLoader.on("beforeload", function(treeLoader, node) {
treeLoader.baseParams.param = globalVar;
},
this
);

var myTreePanel = new Ext.tree.TreePanel({
rootVisible: false,
border: true,
autoScroll: true,
root: new Ext.tree.TreeNode(),
loader: myTreeLoader,
listeners:
{click:
function(node){
if (node.attributes.leaf) {
alert(node.attributes.text);
}
}
}
});

function loadTreeData(param) {
globalVar = param;
westPanel.layout.setActiveItem('panel-1');
var treeMask = new Ext.LoadMask(westPanel.getEl(), {msg: 'Getting tree data for ' + param + '...'});
treeMask.show();
myTreeLoader.load(new Ext.tree.TreeNode());
treeMask.hide();
westPanel.doLayout()
}


There is an Ext.onReady() function that creates the border layout and adds myTreePanel as an item of the first panel in an accordion layout.

The second panel of the accordion layout has a tree in it and when a node is selected loadTreeData is called with the value of that node.

Firebug shows the call to get the data is successful and returns the data I would expect, but the TreePanel in the first accordion panel is not displayed. Also, the mask doesn't show or hide either.

What is missing in this workflow?

Thanks

Dennis