Pages

Wednesday, 20 May 2015

APEX 5 alternative to gReport.data.view('DETAIL')

I'm sure we've all done it at some point or another, used some "feature" in the database you're probably not meant to.

Interactive reports still have a few misgivings prior to APEX 5 so some tried to utilise gReport object, since it was available in the generated page but undocumented - which in Oracle speak means that they're more than entitled to change behaviour in future without telling or supporting you.

I understand htmldb_Get put developers in a similar situation, but apex.server.process became a brilliant alternative.

APEX product manager Joel Kallman goes into a discussion on IR changes APEX 5 here, but what I was interested in was an alternative to
gReport.data.view('DETAIL');

This enabled the detail view of an IR to be utilised without the need for the search bar to be displayed.

I have an example of a detail IR in my plugin workshop application. I discovered my solution no longer worked in the APEX 5 deployment around the time this was posted on the forum.
https://community.oracle.com/thread/3716074

JavaScript guru Tom Petrus suggested to simply simulate the row click. The following code goes a step further and hides the search bar since it needs to be defined at design time as shown. I added p10_plugins as the static region ID of the IR region, then added this to execute on page load:

$('#p10_plugins_toolbar').hide();
$('#p10_plugins button.a-IRR-button--views[data-view=details]').click();
Amazing what jQuery can do, though it does mean the browser has more work to do after rendering the page.

I've discovered a better alternative since using the IR detail view. Named column row templates also offer conditional templates for different row types.

No comments:

Post a Comment