Use jQuery to check if a report returned rows in ApexAugust 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:
- Make sure to give your report a static ID. In this example it is emp.
- 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.
- Interactive Report:
- Here, if the length comes back as one, the report returned no rows.
Thanks to @rimblas for a correction.