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.

How to access Treeview by Javascript?

John like many othersJul 29 2020 — edited Aug 7 2020

Hello

I have successfully created a hierarchy tree with the Treeview widget. On loading the page I can see the structure. This can change in the background so the user should be able to refresh it. In the documentation I've found the r"efresh" option::

$( "#HIERARCHYTREE" ).treeView( "refresh" );

So when the user presses a button I simply want the treeview refreshed. Instead of I get this error message:

desktop_all.min.js?v=19.2.0.00.18:2 Uncaught Error: cannot call methods on treeView prior to initialization; attempted to call method 'refresh'

    at Function.error (desktop_all.min.js?v=19.2.0.00.18:2)

    at HTMLDivElement.<anonymous> (desktop_all.min.js?v=19.2.0.00.18:27)

    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 k.fn.init.a.fn.<computed> [as treeView] (desktop_all.min.js?v=19.2.0.00.18:27)

    at Object.javascriptFunction (f?p=107:25:106888120606339::::::246)

    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 HTMLButtonElement.<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)

I assume the selector is correct. I set the value HIERARCHYTREE to the Static ID of the region "Widget", which holds the widget. Everything is there to rebuild the tree (no processes are going on). The refresh is triggered by a simple button (onclick). Any other try to access the treeview shows the same error message, i.e.:

var test= $("#HIERARCHYTREE").treeView("getExpandedNodeIds");

I couldn't find anything in the documentation that I'm doing wrong. I thought the simple access should be enough to refresh the tree view.

-> Working with Apex 19.2

Any help is appreciated!

Comments
Post Details
Added on Jul 29 2020
4 comments
1,250 views