Dynamically set Oracle Apex 5.1 interactive grid region header - oracle-apex

I'm wondering if it's possible to dynamically change the interactive grid region header text. I have an IG that provides detail from a "master" report, and I'd like the HTML header text to update dynamically to display the title of the master record being displayed.
I'm guessing I'll need to create a custom dynamic action, but I'm not sure how to identify / reference the region header text element.
I appreciate any ideas.

I created a Master/Detail page based on DEPT/EMP to come up with these steps.
Give the child region a static id (I used js-ig-emps).
In the Page Designer, right-click the parent region and select Create Dynamic Action.
For the Dynamic Action, set Event to "Component Events > Selection Change [Interactive Grid]".
For the Action, set Action to "Execute JavaScript".
In Code, enter some JavaScript that updates the header of the child region using data from the parent.
Here's the code I used:
var selectedRecord = this.data.selectedRecords[0];
var selectedDept = this.data.model.getValue(selectedRecord, 'DNAME');
var newText = 'Employees in ' + selectedDept;
$('#js-ig-emps .t-Region-title').text(newText);
That assumes you're using Universal Theme. You'll need to make adjustments according to your requirements and the columns you have access to from the parent region.

Related

How to display card buttons conditionally?

I am using new Oracle APEX card region, I have two buttons which should be displayed depending on row data. How to achieve that?
There are 2 ways to add a button in a cards (using new card region).
Using "Actions". In this case the "server side condition" can be bound to the row data. For example if I have a card region on the EMP table the server side condition of "Item = Value" with item = ENAME (column name) and value = 'KING' would only make the button visible for the record of the employee named 'KING'
Using 'Template Directives'. This is when you display the button in one of the sections (title/subtitle/body/secondary body). To achieve this, toggle "Advanced Formatting" of the region and put your own markup in it. A button can be built using the button builder in the Universal Theme application and the display can be controlled using template directives. Note that in this case you'll have to submit using a dynamic action. Read more on template directives here or in the docs

Oracle Apex - All tabs showing at once instead of only active tab

I created an apex page wherein i need to split my classic report of 50 columns into 5 tabs with 10 columns displaying in each.
So for each section, i created a static content region with template as tabs container.
Inside it as sub region i added the classic report.
Start New Row->No so that the Tab headers are all side by side.
After doing this for all 5 tabs when i run the page it shows all 5 tabs whereas i need to see the 1st tab by default and the rest only when i click on the respective tab name.
So only the tab on which i click needs to be active.
What am i implementing incorrectly here?
I would use a region display selector for this.
Create a region with template 'blank with no attributes'. This is typically placed in breadcrumb bar location, and can be configured to not 'show all'.
Now any content region with attribute 'region display selector' is shown tabulated.
Often you'll need to take care to ensure inline dialogs or other note regions don't have this attribute selected.

How to disable edit mode of oracle apex interactive grid on double click?

I am using an interactive grid in oracle apex. When we double click the grid it goes into an edit mode. I want to get rid of this functionality because my grid is not editable this way.
if you don't want the user to be able to edit row content, change the column type under Report -> Columns -> Your column -> Type. For example try setting it to Display only so that the users cannot change the content.
I have been trying to replicate the same from a long time. Just found a workaround for this.
Create Dynamic Action on Interactive grid on event Double Click
Set Action = Execute JavaScript Code
Use following code in action
apex.region("emp").widget().interactiveGrid("getActions").set("edit", false);
Make sure to replace emp with static ID which you should provide in IG region.

How to use APEX$ROW_SELECTOR with Dynamic Actions within an Interactive Grid

Environment: Oracle APEX 5.1.2 / Oracle 12c
I'm currently using an Interactive Grid (IG) with the APEX$ROW_SELECTOR set to single record selection (i.e. radio group). What I am attempting to do, is use a Dynamic Action "Click" event off this APEX$ROW_SELECTOR, but unfortunately it's not firing when I click on the radio group selector.
I have the following questions based on the above:
How to add a Dynamic Action on row selection (APEX$ROW_SELECTOR) to fire when clicked?
When clicked, how to set a column value in session state to be used within a classic report?
Assuming the above is NOT possible with a Dynamic Action as part of an IG, how else can I perform something similar when a user selects a row with my IG?
You can search the class in the dom
.u-selector
Create a dynamic action using this class
And the result is
You need to follow the below steps:
You need to set a static class to the clickable column.
Create a new dynamic action of type "click"
The selection type would be JQuery Selector.
in the Selector field you need to fill the static class you mentioned in the column attributes.
You need to put the html id of the column as the id of the row and capture the value of it as follow in javascript:
this.triggeringElement.id -- it will capture the clicked item.
-Once you catch the value, you can set it to Page item and do whatever needed.

Oracle APEX - Reusable Pages?

We have some tables in our database that all have the same attributes but the table is named differently for each. I'm not sure of the Architect's original intent in creating them in this way, but this is what I have to work with.
My question for all the expert Oracle APEX developers: is there away to create a reusable page that I can pass the table name to and that table name would be used in the reporting region and DML processing of that page?
I've read up on templates and plugins and don't see a path forward with those options. Of course, I'm new to webdevelopment, so forgive my ignorance.
We are using version 18.2.
Thanks,
Brian
For reporting purposes, you could use a source which is a function that returns a query (i.e. a SELECT statement). Doing so, you'd dynamically decide which table to select from.
However, DML isn't that simple. Instead of default row processing, you should write your own process(es) so that you'd insert/update/delete rows in the right table. I've never done that, but I'd say that it is possible. Basically, you'd keep all logic in the database (for example, a package) and call those procedures from your Apex application.
You could have multiple regions on one page; one region per table. Then use dynamic actions to show/hide the regions and run the select query based on a table name selected by the user.
Select table name from a dropdown or list
Show the region that matches the table name (dynamic action)
Hide the any other regions that are visible (dynamic action)
Refresh the selected region so the data loads (dynamic action)
If that idea works let me know and I can provide a bit more guidance.
I never tried it with reports, but would it work to put all three reports in a single page, and set them via an Item to have Server-Side Conditions that decide what gets shown in the page? You'd likely need separate items with a determined value for the page to recognize and display.
I know I did that to set buttons such as Delete, Save and Create dynamically, rather than creating two or more separate pages for handling editing of certain information. In this case it regarded which buttons to shown based on a reports' primary key being sent to said "Edit" page. If the value was empty, it meant you wanted to create a new record (also because the create button/link sent no PK). If said PK was sent (via a edit button/link), then you'd have the page recognize it and hide the create button and rather show the edit button.