PDA

View Full Version : TreePanel and Xajax, please help



feendrache
16 Apr 2010, 4:59 AM
Hi there,
ok, i want to use Extjs for a web-surface.
What i need is a treepanel.
And i want to load the nodes with an xajax function i registered. But i have no clue how to do it.

Can someone give me a hint?

Greetings
Nadine

soze
16 Apr 2010, 7:24 AM
I haven't used xajax but this sample code should at least get you past the Tree Panel side of things. The response from my asp file is json.

Not sure what you're implementation is but I've also thrown in a little piece of code on checkchange event. In my implementation, this is a list of regions and the offices within that region. The 1st element within the node is always 'All offices' for that particular region. That event will automatically disable other checkboxes within that node structure.


all = false;
var impactList = new Ext.tree.TreePanel({
id: 'impactPanel',
hidden: true,
useArrows:true,
autoScroll:true,
title:'Please select the Office locations that are being Impacted.',
height: 400,
animate:true,
enableDD:true,
containerScroll: true,
rootVisible: false,
frame: true,
root: {
nodeType: 'async'
},
dataUrl: 'functions/disruptions/getBuildings.asp?id='+id,
listeners: {
'checkchange': function(a, b){
tt = Ext.getCmp('impactPanel').root;
len = tt.childNodes.length;

all = false;
for(i=0;i<=len-1;i++){
if(tt.childNodes[i].firstChild.id===a.id){
all=true;
//Disable all other child nodes
if(b===true){
for(j=1;j<=tt.childNodes[i].childNodes.length-1;j++){

tt.childNodes[i].childNodes[j].attributes.checked=false;
tt.childNodes[i].childNodes[j].unselect();
tt.childNodes[i].childNodes[j].disable();
}
}else{

for(j=1;j<=tt.childNodes[i].childNodes.length-1;j++){
tt.childNodes[i].childNodes[j].enable();
}
}
}
}

impactList.doLayout();
}
}
});

impactList.getRootNode().expand(true);