Thursday 16 October 2008

Linking in between tree #DRILL_DOWN#

This post is an addon to my previous post: Customizing APEX trees.
The previous post was pretty much complete EXCEPT (offcourse there's an exception) for the cases when the user was expanding or collapsing the tree !
To interfere with the process of expanding or collapsing the tree (we will generically define this as drilling from now on in this page) we need to take a look in the tree definition page at the Dynamic templates section.
We can find there, this tiny piece of info that looks like:
a href="#DRILL_DOWN#"
This is where the linking is made, and the #DRILL_DOWN# string contains everything we need: the method (expand or contract) and the node id that has to be applied that method.
So, as we did before, we can put a call to a Javascript instead of the direct link, append all our form field values to the link and only afterwards we can redirect the page...
Instead of the above, we can therefore have something like:
a href="javascript:treeDrilling('#DRILL_DOWN#');"
And in the treeDrilling we can easily redo everything we have done in the previous tutorial with the persistFormData function ...
Maybe the only thing that one may note there is the format of the #DRILL_DOWN# string, which is obviously a link like:
f?p=&APP_ID.:7:&APP_SESSION.:EXPAND,NODE_ID
OR
f?p=&APP_ID.:7:&APP_SESSION.:CONTRACT,NODE_ID
The expand and contract commands are given inside the APEX link, just after the session id, AND we can still append to the above the values of our form data !!
Once again - I hope this helps !

No comments: