Skip to Main Content

Further bugs in tree widget's API (Apex 19.2)

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);
-> 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=
at Object.da.doActions (desktop_all.min.js?v=
at HTMLDivElement.<anonymous> (desktop_all.min.js?v=
at Function.each (desktop_all.min.js?v=
at k.fn.init.each (desktop_all.min.js?v=
at Object.da.actions (desktop_all.min.js?v=
at HTMLDivElement.<anonymous> (desktop_all.min.js?v=
at HTMLDivElement.dispatch (desktop_all.min.js?v=
at HTMLDivElement.v.handle (desktop_all.min.js?v=

NO clue what the icon has to do with unselecting a tree element..

Post Details
Added on Nov 26 2020