Saving tree structure after drag&drop
I have an async tree and my users are allowed dragging&dropping nodes. When they drag&drop a node, I save the new position into a database. That's ok.
However, I have a problem when the node (the target node) where the selected node is dropped is not initialized. In this case, in fact, ExtJs first loads its children. In other words, this is what happens:
1) The user drags node A and drops it into node B
2) In the BeforeDrop event I save the new position of node A into database. I use the BeforeDrop event because, if the saving fails (e.g. db is down), I can cancel the drop
3) After that, ExtJs realizes that node B is not initialized, and so loads its data from the db
4) But since the db already contains the new position of node A, node A is already loaded
5) Finally the original node A is dropped into node B, thus resulting in a duplicated "node A" (because the first one was loaded from the db)
I hope I was clear. This problem happens only when node B is not initialized; if it's initialized, then everything works (because ExtJs does not have to load its children from db).
How would you solve this issue? What is the best practice?
Thanks,
Paul
Thanks,
Paul
No one can try to help? Thanks! :)
Paul