Tree sort order save in DB

i want to save the order of items in a tree to a DB. I’ve tried to update after drag and drop, but this is not working for me.

What is want to do is:
After an update to a tree (using dataprocessor) i want to loop over all tree items and update the order in the DB.

Question:
How can i loop over all tree items when using a custom update function?

How can i loop over all tree items when using a custom update function?

Are you asking about database data ? You may use sql queries in this case.

No i would like to access/send all data from the tree (specifically the order) to a function which can update the database records

You may mark all items “updated” as follows:

var list = tree.getAllSubItems(0);
var ids= ids.split(",");

for(var i=0; i < ids[i].length; i++)
dp.setUpdated(ids[i],“updated”);

In this case all items will be sent by dataprocessor.

There are also serializeTree() and serializeTreeToJSON() methods that return xml or json string Tree.

Ah cool. and i can call this function IE OnDrop. thanks!