Wednesday, June 1, 2011

Invoke actions on non-command component

It's a small demo on how to perform additional actions on click a goLink component which doesn't support any action logics inherently. The solution is to use javascript to invoke a command component programatically. But why do I need to perform some action on a golink click, why don't I use commandLink directly? Well, the reasons can be many, one of the valid reason is if you have such requirement like: on click of a link, open a predefined URL in a new window and also perform some action. I know there must be other similar scenarios which could be categoried into the same group like this one.

The implementation is fairly easy. Here is the code snippet:



The command link is hidden and aligned after goLink in page source. The additional action logics is defined in the action listener of the command link. 

Here is the demo to download. (JDeveloper 11.1.1.5 and need HR schema objects to run)

2 comments:

Wildcard SSL Certificate said...

cheers for the guide, i have had lots of issue with this on are new servers.

zeeshan said...

It really a usefull post.