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.

Expand tree not working in Apex 19.2?

Hello
Before I waste some other hours someone might confirm this is a bug in Apex...
Aim: I want to re-open a tree to the state where it was before I do the page reload.
There is an attribute called 'Selected Node Page Item' in the Attributes area of the tree widget. The inline help is very foggy about how it works nor there is an example:
This item is used to save tree state, by holding the value of the last selected node. The value of the selected node can be saved to the selected item via the node link attribute, or via a page process. When the page is reloaded, the tree is opened to the selected node value.
Exactly what I need, perfect! The big question here: What is meant by "value"? ID of the selected element in the tree, object, JQuery object, ... ? Only heaven knows...
So I create a hidden page item called P25_TREE_SELECT that will be filled with the 'value' to expand after page reload. Furthermore I set Selected Node Page Item to P25_TREE_SELECT.
I create a test button doing this in several Dynamic Actions:
-- Step 1: Set value to P25_TREE_SELECT
// Get tree
var tree = $( "#HIERARCHYTREE_tree" );
// Get adatapter data
var adapter = tree.treeView( "getNodeAdapter" );
// Get node of selection
var treeSelected = tree.treeView( "getSelectedNodes" );
// Option 1: Set selection as object
apex.item('P25_TREE_SELECT').setValue( treeSelected[0] );
// Option 2: Set ID of selected element in tree
apex.item("P25_TREE_SELECT").setValue( treeSelected[0].id );

-- Step 2: Make sure P25_TREE_SELECT is in session before page reload
BEGIN
APEX_UTIL.SET_SESSION_STATE('P25_TREE_SELECT', :P25_TREE_SELECT);
END;

-- Step 3: Page reload
location.reload();

After page reload the tree keeps closed, no matter I choose Option 1 or Option 2.
Anything else I have to send as "value" or did I miss anything? Any documentation or video showing how it should work (if it does)?
Regards

Comments

Post Details

Added on Nov 25 2020
0 comments
317 views