I have a couple of classic report columns that are links and a region display selector with a couple of regions under it. How can I switch between RDS regions dynamically when a corresponding column link is clicked?
I tried setting link type to URL and set it to
apex.region("RDS").widget().aTabs("getTabs")["#MY_TAB_STATIC_ID"].makeActive();
But that did not work - APEX tried to go to a different page.
Here is one option. I didn't use page items but you'll probably be able to reuse the logic:
Create 2 regions, give them static id rdsregion-1 and rdsregion-2
Create a display selector
Create a static report with the following sql:
select EMPNO,
ENAME,
JOB,
MGR,
HIREDATE,
SAL,
COMM,
DEPTNO ,
CASE WHEN SAL > 2500 THEN '<div class="setrds1">set rds 1</div>' ELSE '<div class="setrds2">set rds 2</div>' END as rds
from EMP
Create a dynamic action named "Set RDS1"
Event: Click
Selection Type: jQuery Selector
jQuery Selector: .setrds1
add a true action to DA "Set RDS1" o
Action "Execute Javascript Code"
Javascript code:
$('#rdsregion-1_tab a').trigger("click");
Create a similar dynamic action for RDS2.
Note that both snippets work:
$('a[href="#rdsregion-1"]').trigger("click");
and
$('#rdsregion-1_tab a').trigger("click");
Related
I'm trying to change the language of default UI elements language in my APEX application to Arabic language :
i change the button (excepted interactive button) and column header language using XLIFF file , but i can't change action menu language , how i can do that if it possible.
You have to create new "messages":
Try to find message id:
select *
from APEX_APPLICATION_TRANSLATIONS
where WORKSPACE = 'INTERNAL'
and message_text = 'Subscription';
Copy TRANSLATABLE_MESSAGE field value (e.g. APEX.IG.SUBSCRIPTION or APEXIR_SUBSCRIPTION) and remember IS_JS_MESSAGE value
Go to Shared Components -> Globalization -> Text Messages -> Create Text message
Put id id name field (APEX.IG.SUBSCRIPTION)
Select your language
Fill "Text"
Select the same value as already exists in field IS_JS_MESSAGE
Your application language must me the same with this new message.
Created an report with checkbox using apex_item and when checked more than one check box i will display alert message "not to check more than one checkbox with ok button " after clicking ok it should be unchecked . please find my JavaScript code that displays alert message
if($("input[type=checkbox]:checked").length > 1)
{
var msg = alert('You are not allowed to select more than one employee');
}
It's best to use the APEX JavaScript APIs for this type of thing. You can find them here: https://apex.oracle.com/jsapi
If you're getting started with JavaScript and APEX, you may find these slides useful: https://www.slideshare.net/DanielMcGhan/getting-started-with-javascript-for-apex-developers
Here's a solution that should work for you (just change the name of the item to match yours):
var cbItem = apex.item('P1_CHECKBOX');
if (cbItem.getValue().length > 1) {
alert('You are not allowed to select more than one employee');
cbItem.setValue(); // Passing nothing to clear the value
}
In Oracle APEX, how do I remove different actions in the interactive grid row actions?
I'd like to remove the ability to delete or add rows from both the row actions and selection actions menu.
Region Settings, Advanced, Static ID: emp
Page Settings, JavaScript, Execute when Page Loads
$(window).on("load", function() {
var actions = apex.region("emp").widget().interactiveGrid("getActions");
actions.remove("selection-add-row");
actions.remove("selection-duplicate");
actions.remove("selection-fill");
actions.remove("selection-clear");
actions.remove("selection-delete");
actions.remove("selection-copy-down");
actions.remove("selection-copy");
actions.remove("selection-refresh");
actions.remove("selection-revert");
actions.remove("single-row-view");
actions.remove("row-add-row");
actions.remove("row-duplicate");
actions.remove("row-delete");
actions.remove("row-refresh");
actions.remove("row-revert");
});
You can change "emp" to anything you'd like, change in both the static ID and javascript. Delete the lines you'd like to keep.
You can use actions.hide("{action_id}") and actions.show("{action_id}") to hide and show the row actions.
Back with a new issue. I want to delete a row from an IR by having a delete icon as a column in the report itself and when I click on that icon a DA will fire which will call a code to delete that record and also will call API to delete the rows from fnd_attached_documents.
I did the following
Created an IR with the following query :
SELECT nvl(to_char(task_id), '-') "Title",
'-' "Type",
nvl(description, '-') "Description",
'-' "Category",
-- nvl(last_updated_by,'') "Last Updated By",
nvl((SELECT v('APP_USER') FROM sys.dual), '-') "Last Updated By",
nvl(last_update_date, SYSDATE) "Last Updated",
dbms_lob.getlength(file_content) download,
attachment_id,
document_id,
media_id,
'' "Delete"
FROM my_attachments
WHERE task_id = :p2_case_number;
Delete is not a column in the table and P2_CASE_NUMBER is an Item. Once the report was created I went to the report attributes --> Column Attributes and clicked on the Edit icon of delete and in the column link selected the icon and target as URL gave the following URL -
My DA is as follows
Name - DELETE_ATTACHMENT
Event- Custom
Selection type - DOM Object
DOM Object Title
True Action : PL/SQL code
DECLARE
lv_case_number NUMBER;
lv_attachment_id NUMBER;
BEGIN
lv_case_number := :P2_CASE_NUMBER;
APPS.DELETE_FILE_ATTACHMENT(lv_case_number,lv_attachment_id);
END;
Now I am facing the following issue and dont know what to do about them
I need to pass the attachment Id coming from the report as the second parameter to procedure I am calling, so how do I do that?
I need to refresh my report region only so that when delete happens I dont have to refresh the page myself?
I am using ebs r12 and apex 4.2
Thanks
You have to add the attachment id to link attributes and also a css class, that you can reference later in the DA:
data-id="#ATTACHMENT_ID#" class="delete-row"
You will need a hidden item to save the attachment id of the clicked row. In this example:PX_ATTACHMENT_ID
Then create a DA that is triggered when the link is clicked:
Event:click,Selection type:jquery selector,jquery Selector:.delete-row
Event scope of the DA should be dynamic, otherwise it won't work after the first refresh of the region.
Add a true action:
Action:set value,Set Type:Javascript Expression,Javascript Expression:this.triggeringElement.getAttribute('data-id'),Affected Items:PX_ATTACHMENT_ID
Add another true action:
PL/SQL Code to delete the attachment and make sure that you add PX_ATTACHMENT_ID to Page Items to Submit
Add another true action:
refresh report
https://apex.oracle.com/pls/apex/f?p=111339:2
I have a tabular form attribute which is a select list with static values Yes/no and another 2 attributes of Date and display.
My requirement is when i select "No" from the Select List, Date attribute should be enabled and Display attribute should be Disabled and If "Yes" From select list Display attribute should be enabled and Date attribute should be Disabled.
Dynamic Action:
Created a Dynamic action:
event = Change
Selection Type = Jquery selector
Jquery selector = `select[name='f06']`
Action = Execute javascript Code
var el = this.triggeringElement.id;
var row = el.split("_")[1];
if ($v(el) == "N") {
// disable the field
$x_disableItem("f04_" + row, true);
}
else {
// enable the field
$x_disableItem("f04_" + row, false);
}
Dynamic action Working perfectly for already created Rows, But not while i am trying to add new Row by selecting Add row.
https://apex.oracle.com/pls/apex/f?p=38210:LOGIN_DESKTOP:115699939041356
App 38210. Apex 4.2.6
Workspace/username/password : nani4850
Kindly help me out experts!!
Adding a blank row involves a partial page refresh, so the Event Scope of your dynamic action needs to be changed from Static to Dynamic in order for the change event handler to remain bound to the triggering elements.
You'll now find you have problems submitting new records, but if you're having difficulty, that's for another question!