Showing posts with label interactive grid. Show all posts
Showing posts with label interactive grid. Show all posts

Friday, September 14, 2018

How to set IG default values for email fields when downloading report

Few days ago I've got interesting APEX question (I don't mind that the question was sent by mail, but there's Oracle Community Forum where you can get quicker answer and more people will benefit from it).

..and the question is: how to define default values for fields that are shown when you want to download Interactive Grid report and send it by the e-mail.


Maybe I'm wrong but I think there's no native way to do this so I found a workaround.
You can do this for a specific region/page or globally by using global page (page 0).

First of all you need to create on click dynamic action triggered on checkbox item "Send as Email":


The Event Scope attribute must be set to Dynamic and if you want to restrict this dynamic action to the specific region you should define Static Container (jQuery Selector) property with static ID of IG region (for example #emp, if static ID of a region is emp).

You also need to create true dynamic action of a type Execute JavaScript Code where you can define items and values that you want to set:



Demo is available here.

Tested in APEX 18.1.0.00.45.

Enjoy!

Tuesday, December 12, 2017

Interactive Grid: How to Fix Blank Toolbar DIV

One of the best functionalities of the Interactive Grid is declarative master-detail option. That's the reason why I like to use them also in readonly mode. Most of the time I don't need toolbar in detail regions so I turn it off (Region Attributes > Toolbar > Show = No).

But, currently (in APEX 5.1.4.00.04 and less) there's little bug that I can't ignore. It's 9px blank div above report headers:



At first I thought that's easy - I'll just use :empty CSS pseudo selector and hide DIV element with CSS class .a-IG-header:
.a-IG-header:empty{
  display:none
}
But that breaks sticky headers when you scroll down. To fix that I had to use different CSS:
.a-IG-header:empty{
  padding:0;
  border-bottom:0
}
If you want to use other regions for master-detail pages take a look at my plugin on apex.world.

Demo is available here.

Tested on apex.oracle.com (v5.1.4.00.04).

Enjoy!

Friday, March 17, 2017

APEX 5.1 Master detail (with Interactive/Classic Detail Report)

You probably know that in APEX 5.1 you can easily make a master-detail report regions declaratively by using an Interactive Grids (IG).

But what if you don't want all those fancy IG stuff (I know, I know...you can hide/disable all of it) but plain old Classic (or Interactive) Report for a detail report. No problem, it's only few clicks away!

Let's take a well known example with the dept and emp tables.

First of all you have to create an Interactive Grid over the dept table (master):














Don't forget to put the DEPTNO into SQL Query. It can be hidden, but you have to put it in.

Next step is to create a hidden item (with Value Protected property set to No) where you will temporary store the DEPTNO of the selected grid row (in my case it's P28_DEPTNO):



Then you can create your detail report (Classic or Interactive) over the emp table with where condition that references your hidden item (don't forget to put it in Page Items to Submit):



Next step is to create a dynamic action with event Selection Change [Interactive Grid] over the dept region:


For first true action use Set Value with the Set Type Javascript Expression and define it as:

this.data.selectedRecords.length != 1 ? '': this.data.model.getValue( this.data.selectedRecords[0], "DEPTNO")
and for an Affected element choose your hidden item:



The second true action should be a refresh of your detail region...and thats all.

Live demo is available here.

You can use similar approach if you want this to work with a multiple selected rows (for example in editable grid) but then you should change Set Value DA and where condition of your emp query to support this.

Enjoy!

Tested on APEX 5.1.0.00.45