Refresh dhtmlxtree without using the dataprocessor for delet

hi,



I do modify things from my tree without using the dataprocessor (using a personal ajax request).



Then, I want to refresh my tree using this code: tree.smartRefreshItem(itemId)

The problem is that the dataprocessor execute a query to delete items that are no longer in the new data tree after the refresh, as I have already deleted them manually.



Is it possible to prevent these queries to run?



    

sorry for my poor english.

Guillaume


Hello,


could you please expain in details what should be do to re-create the issue.

To recreate the problem you must:
1) initializing a tree (dynamic loading) with data loaded from a database
2) make changes to the database (without using the dataprocessor)
3) try to see changes in the tree. (as if we initialize the tree again, but retaining the open nodes)

I can not do this.
What is the best way to do?


Hello,


in case of dynamic loading the only way to reloaded the whole tree -this is to loaded the tree again and restore the open state (dhtmlxtree_xw.js extention):


tree.saveOpenStates();
tree.deleteChildItems(0);
tree.loadXML(root_xml,function(){
tree.loadOpenStates()
})



thank you for this response, it helps me.
I ask me if it’s possible to do less brutal, since I know exactly which nodes have been changed.

I have write this code :

//item1 and item2 are the 2 parents node i need to refresh
tree.smartRefreshItem(item1);
tree.smartRefreshItem(item2);


But sometimes I have a conflict, when the first refresh of the elements
is not finished and there are nodes in common with the second, I have a
error (duplicate content or XML error)


I
bypassed this error by adding timeouts but I do not find safe :

//with timeouts
contacts_tree.smartRefreshItem(item1);
setTimeout(function(){
     tree.smartRefreshItem(item2);
}, 500);


The
ideal would be to run the second smartRefreshItem when the first is finished,
without using a timeout.
Is there a way to do this?

thank’s





There is onXLE event that is called after xml loading.


loadingH = contacts_tree.attachEvent(“onXLE”,function(){
contacts_tree.detachEvent(loadingH);
contacts_tree.smartRefreshItem(item2);
})
contacts_tree.smartRefreshItem(item1);



thank you, that’s exactly what I needed.
your support is very efficient! thank you