Use jQuery to check if a report returned rows in Apex

August 19, 2014 at 2:03 pm | Posted in Oracle Developement | Leave a comment

In order to conditionally hide/show a button, I needed to know whether a particular report on a page returned any rows.

This can easily be done with a line of jQuery, which differs between classic and interactive reports:

  1. Make sure to give your report a static ID. In this example it is emp.
  2. Classic Report:  If data is returned there will be a div with an id that prepends ‘report_’ to the report static id. Check the length of that div to find out if it exists. If it doesn’t, the length will be zero, meaning no rows were returned.
    1. $('#report_emp').length
  3. Interactive Report:
    1. $('#emp').find('div[id="apexir_DATA_PANEL"] table').length
    2. Here, if the length comes back as one, the report returned no rows.

Thanks to @rimblas for a correction.

Advertisements

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

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: