1
votes

I am using Oracle Application Express (APEX) where I have created a Report Region and as part of the title of that I region, I have entered the following:

<div id="abc" style="font-weigh:bold;font-size:18px;"></div>

In the region source, I have my required SQL report query.

I am attempting to use jQuery so that I can hide and show this region based on div id value of "abc". When I attempt to use $("#abc").show(); or $("#abc").hide()', nothing happens from the looks of it (it can't find this div id?).

Am I doing something wrong or is it not possible when using an APEX SQL report region?

2

2 Answers

3
votes

When you issue $("#abc").hide(), JQuery hides the contents of the div with id "abc" - i.e. any HTML/text between the opening <div> and closing </div> tags. In your example there is nothing between these tags to hide and so nothing will change.

If you want to hide the entire region then the div needs to surround the entire region. You could achieve this by removing the </div> tag from the title and adding it in the region footer. However there are much easier ways to achieve this:

1) Give the region a Static ID of "abc". Your show/hide code will then work without the need to add your own div tags.

2) If you are using Apex 4.0, create a Dynamic Action to show/hide the region instead of writing JQuery code.

1
votes

Your ideea works.

Go int "EDIT REGION" for the region you want to hide/show :

<div id="abc" style="font-weigh:bold;font-size:18px;"> put it in Region Header and of course </div> in the Region Footer.

The Jquery will work fine.

Test it out with firebug to see if the selector returns any result.

I have done this plenty of times and i think using Dynamic Actions only complicates things.