Do your xhtmltree have a extension that a could implement a

do your xhtmltree have a extension that a could implement a context menu
for right click for each of them items in a tree.

for  example the options in a
context menu

 
delete item

move up item

move down item

edit item

Pro version of dhtmlxTree supports integration with dhtmlxMenu, which can be
used as context menu. In such case the menu handler will receive Id of selected
menu item and Id of item it tree for which action called, so any kind of logic
(including operation in your example) can be implemented.

You
can check samples/pro_context_menu.html

The tree package contains only necessary files of dhtmlxMenu, to obtain
documentation and samples you can get full menu package from scbr.com