tags:

views:

332

answers:

2

i have a a tree structure of folders and documents. There are options to edit, delete, move and add new folders and documents. When the user do these actions I will have a jquery ajax call to update the database.

The question is how to refresh the tree structure when the update is done? it is not in an iframe or frame.

i don't want to server to have to return HTML code using div tag and innerhtml value (which is what a lot of my searches come up with).

i am using jsp with java backend.

Currently the tree is just good old html but we might consider using a jquery plugin.

A: 

Can you return JSON data back to the page and use jquery to manipulate the tree structure.

CSharpAtl
as we won't know which part of the tree is changed the JSON data would have to be the whole tree? no?
mango
If there is no way to determine the changes and send those back....you will have to send the data that you will need to construct the tree.
CSharpAtl
A: 

CSharpAtl has a good idea, you could use that as a starting point. As one of your JSON members, you could also include an XPATH of the portion that changed (and thus indicating what's returned in the AJAX response), but that could start to get complicated very quickly. It may be quicker and easier (code-wise) just to return a whole (sub)tree, assuming it won't make an unacceptable performance hit to your application.

Alex Marshall
thanks, it seems complicated, but will give it a try.
mango