Some further bugs in Apex Tree widget (19.2). Might help to anyone else before wasting hours to make it working:
1. Move a node to another node with moveNodes method:
var tree = $("#<Identifier of Hierarchy Tree>");
var selection = tree.treeView("getSelection");
var targetId = apex.item('P25_SELECT_TARGET').getValue();
var targetNode = $("span:contains('"+ <Label text of target node> +"')").parent();
tree.treeView("moveNodes", targetNode, 0, selection);
tree.treeView('refresh');
-> Node NOT moved after refresh, no error message in Console
2. There's a sample in APEX 19.2 API documentation how to unselect an element in a tree:
$( ".selector" ).treeView( "setSelection", $() );
But if you use this you just get:
f?p=107:25:5508291862342::::::1754 Uncaught TypeError: Cannot read property 'icon' of undefined
at Object.javascriptFunction (f?p=107:25:5508291862342::::::1754)
at Object.da.doAction (desktop_all.min.js?v=19.2.0.00.18:21)
at Object.da.doActions (desktop_all.min.js?v=19.2.0.00.18:21)
at HTMLDivElement.<anonymous> (desktop_all.min.js?v=19.2.0.00.18:21)
at Function.each (desktop_all.min.js?v=19.2.0.00.18:2)
at k.fn.init.each (desktop_all.min.js?v=19.2.0.00.18:2)
at Object.da.actions (desktop_all.min.js?v=19.2.0.00.18:21)
at HTMLDivElement.<anonymous> (desktop_all.min.js?v=19.2.0.00.18:21)
at HTMLDivElement.dispatch (desktop_all.min.js?v=19.2.0.00.18:2)
at HTMLDivElement.v.handle (desktop_all.min.js?v=19.2.0.00.18:2)
NO clue what the icon has to do with unselecting a tree element..