PDA

View Full Version : Trying to send Tree node id as different param [Solved]



DannyR
4 Nov 2007, 11:24 AM
Hey gang -

Thanks again for the help thus far. I need a little help on this one.

The server is expecting a differently-named parameter for what the json input data calls "id". So I'm trying to send a parameter called "resourceId" along the url:




var tree = new Tree.TreePanel('navigator', {
animate:true,
enableDD:false,
loader: new Tree.TreeLoader({
dataUrl:'policy_manager.wl?op=getChildDomains',
baseParams:{resourceId:id}
}),
lines: true,
selModel: new Ext.tree.MultiSelectionModel(),
containerScroll: true,
rootVisible: false
});


I expected that "id" would be the proper name for the data (which is by default sent as the value for the "node" parameter - which I also tried). However, it seems to inexplicably send "ext-gen1" as the value.

Can somebody set me straight?

thx,
-d.

DannyR
5 Nov 2007, 7:44 AM
Actually, I need to know how to pass *any* data node through the url.

So, for example, I have now:


{"text" : "Policy Domains", "id" : "f11e2ad0-0545-11db-9368-9343064864b3", "leaf" : false, "cls" : "icon-domain-root", "op" : "getChildDomains"}

I want to send "op" (in this case my service operation) along the url to get the child nodes. This is what I'm thinking, but Ext doesn't agree with me:



var tree = new Tree.TreePanel('navigator', {
animate: true,

enableDD: false,
loader: new Tree.TreeLoader({
dataUrl: 'policy_manager.wl',
baseParams: {


resourceId: id,


op: op

}

}),
lines: true,
selModel: new Ext.tree.MultiSelectionModel(),
containerScroll: true,
rootVisible: false






});


I'm very close to working out this demo for tomorrow. Any help would be greatly appreciated.

thx,
-d.

DannyR
5 Nov 2007, 4:52 PM
Whew! This one was a toughie. Scoured the forums, docs, et al and tried every combination of everything but finally solved it. So in an effort to give back to the community, here it is (if anyone knows of a better fix, please don't hesitate to correct this newbie's solution:




var

treeLoader = new Tree.TreeLoader({


dataUrl: 'policy_manager.wl',

baseParams: {

op: "getChildDomains"
}
});
treeLoader.on(
"beforeload",
function (treeLoader, node) {
treeLoader.baseParams.resourceId = node.attributes.id;
}





);



Now the node id gets passed along the url as resourceId. Check and mate (feelin' groovy).


best,
-d.