PDA

View Full Version : Ext Tree and JSON-RPC



mcohnen
22 Nov 2007, 11:06 AM
Hi!

I am trying Ext Tree right now, and wanted to obtain my data using JSON-RPC. JSON-RPC is an Ajax Java Framework that allows you easily call your java functions via AJAX. Therefore, you need to make a specific HTTP POST call containing a JSON msg.

This is a correct HTTP POST params to my JSON-RPC Servlet in Firebug:

{"id": 1, "method": "system.listMethods", "params": []}

So i need to make a call via Ext Tree Loader so that HTTP POST params look like the one above. I don't know if this is possible. It always adds a node param with value source


node source


Any ideas of hos to do this for Ext.TreeLoader????

Thank you!!!

damien
22 Nov 2007, 11:21 AM
You can add parameters send when clicking a leaf


tree.loader.on("beforeload", function(treeLoader, node) {
treeLoader.baseParams.node_id = node.attributes.node_id;
treeLoader.baseParams.child_id = node.attributes.child_id;
treeLoader.baseParams.invent = node.attributes.invent;
});The above code adds value's to some baseParams in the tree loader before the tree loader loads the url. Maybe you can use this to add the id etc.

mcohnen
22 Nov 2007, 12:30 PM
Thank you for answer damien, but i think i have not explained well enough.
Is in the first load, when i have no leafs in my tree, and i want to load them from a specific url, when i am having troubles.

All i need is being able to send a HTTP POST request to an url sending following parameter:
extracted from FireBug

{"id": 1, "method": "system.listMethods", "params": []}
How can i do that using dataUrl from Ext Tree Loader ?

So i want that the request made by TreeLoader holds an unique parameter, that is a JSON Object/Element.

Any suggestions??

Thank you!!!

abdulabi
26 May 2010, 9:19 AM
im also having this problem. anyones got any advice so far?