Apex: Show/Hide report column with Radio Button

May 15, 2013 at 11:07 am | Posted in Oracle Developement | 3 Comments

I was asked how to hide/show a column via a radio button in a classic report in Apex.

In order to do this you need a dynamic action triggered on change of the radio group, and a small change to the report template.

First, identify the column you wish to hide. For example empno.

Create a radio group with two buttons (P10_HIDE_SHOW), with values “hide” and “show”. Select “None” for the Page Action when Value Changed.

Create a dynamic action on the radio group (Hide Show Empno):

create_da1

For the action select: Execute JavaScript Code.

create_da3

The dynamic action has to do two things: hide the column heading, then the column values. In order to hide the report column values we need to change the report template and add a rel attribute to all the column values.

rep_template

This allows the JavaScript to reference the column values.

That’s it. The radio button should now hide/show the empno column.

You can see a demo on my apex.oracle.com page.

Advertisements

3 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Hi,

    just a small optimization to your code, you can use

    $v(‘P10_HIDE_SHOW’)

    to read the current value of the radio group. That’s a little bit shorter than the jQuery selector.

    Regards
    Patrick

  2. Thanks Chrisss…Cheers…\m/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: