Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Save new hierarchy order of drag&drop tree to DB

JasperoniMar 24 2016 — edited Mar 24 2016

Hi all,

I have created a tree in Apex 5 which allows me to change the hierarchy of the nodes by simple drag&drop.

To get the Drag&Drop functionality I have found some really helpful hints in the forum.

I have managed to show an alert after changing the order, The alert shows the name of the employee that is moved, the name of the node where the employee is dragged to and the type of movement (inside, before, after).

So I ended up with this in the execute when page loads section:

var regTree = apex.jQuery("#tree_reg").find("div.tree");

  1. regTree.tree({

callback : {

onmove: function(NODE, TREE_OBJ, REF_NODE, TYPE)

{alert(NODE.id+" "+TREE_OBJ.id+" "+ REF_NODE);}

}

});

The rest of my Tree is based on the following example:

http://jastraub.blogspot.de/2010/09/adding-context-menu-to-tree-region.html

The Drag&Drop function works but I have some issues saving the new order in the database.

For example if an employee is moved to a new supervisor.

Unbenannt.png

But I honestly have no idea how to use the tree region for updating any database values.

It does not have to be sophisticated. Either a Button which updates the complete tree order in the DB or a direct save/update after dropping the node would do the job just fine

Any ideas to achieve this is appreciated.

Thanks in advance!

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 21 2016
Added on Mar 24 2016
0 comments
255 views