Search code examples
jquerytreeviewdynatree

dynatree - Updating node Display Order on node drag n drop


I am just starting to use Dynatree and stuck while updating the node display order to database while DragnDrop nodes to and fro.

I tried to google a bit and could not find any helpful links.

So, it will be greatly appreciated of any one can help or shared some helpful links.

Thanks.


Solution

  • I have solved my problem by storing keys on array and use that array to update database for display order index.

    dynatree:
    onDrop: function (node, sourceNode, hitMode, ui, draggable) {
    {
    var resultsToClientNode = [];
    sourceNode.move(node, hitMode);
    $.map(sourceNode.getParent().getChildren(), function (nodelist) {
        if (nodelist.data.addClass == sourceNode.data.addClass) {
            resultsToClientNode.push(nodelist.data.key);
        }
    });
    // This array "resultsToClientNode" holds your node on DragDroped order.
    // Call ajax to update in database.'
    }