Ondrag event attach to an ajax check and update of the datab

Hi,



I want that the drag and drop is authorized only if the user has the necessary rights on source and destination documents. For doing that I have used the components_tree.attachEvent(“onDrag”,function(sourceId,targetId,beforeId,sourceTree,targetTree) which works fine. But the function that is called is using ajax to connect to the database checks the rights, do the update of the parentid if ok and then sends back a true / false callback parameter.



But the components_tree.attachEvent(“onDrag”,function(sourceId,targetId,beforeId,sourceTree,targetTree) is not waiting for the callback to answer. How to force to wait for the callback function.

I am using coldfusion and the cfajaxproxy to connect to the cfc and the db with javascript functions.



Thanks,



Eric


Hello,


you try to apply the following approach:


- to deny drag-n-drop by the onDrag event (it should return true).


- if the server response is possitive, you can moveItem to the necessary possition.


In order to move item you can use moveItem method or deleteItem with insertNewChild instead (teh source and target ids can be got from onDrag event handler).