PDA

View Full Version : TreeLoader:How to catch and change the returned json before it will be applied ?



mabra
16 Jul 2009, 8:29 AM
Hi All !

I want to catch the returned jason, which will be passed from the server to the treeloader, because I'll modify it. My json should return something like a transaction-id, which has to be removed, and finally, the resulting node array should given to the TreeLoader.

I am finding no way. If I use the TreeLoader's load event, it's too late [so far I found no way to cancel the display of the received json].

Any help would really very great!

pmatsumura
16 Jul 2009, 1:48 PM
Why do you want to return JSON data and then remove parts of it? Wouldn't it be a lot easier to just not return your transaction-id? Just wondering.


Patrick

mabra
16 Jul 2009, 3:20 PM
Hi !

That's not possible, the transaction id will be passed with each request [additional parameter]. If the datastore for the tree has changed on the server, a new request for a node from a client with an older tree, would return - logically spoken - invalid data. The client has to reload the whole tree. The transaction id will I pass in my json inside each response. This explains the need to catch the received data, before the tree processes them. Then the transaction id will be checked and if ok, the array of nodes is unpacked from json to feed the treeloader. If the transaction id will not fit, the tree will be loaded completely.

Hope, I was clear.

br--mabra