Good evening to everybody.
At this moment I'm working on a new page for Oracle Apex and again I have trouble with Interactive Report. My page (let it be named 500) consists of Interactive Report with id rep_main and Classic one with id rep_child, which are connected by master-detail logic (I choose the row from the main report and then I get the rows in the child one depending on my choice). Also every row of the main report has several buttons (precisely tags "a" with links like "javascript:..."), which call dialog windows for updating data of the chosen row.
My aim is to make page more comfortable for users: firstly, the chosen row from the main report should change its color; secondly, the reports should refresh correctly. The second condition means, that, after I choose the rown in the main report, the pagination must not change and the view of the page must not scroll up by itself.
I managed to make the master-detail logic and recoloring the rows (thanks to Stack Overflow for helping me with this task) in my IR, but I have some difficulties with the condition of correct refresh. Apart from JavaScript/jQuery functions, I have to call standard Apex function apex.submit, because if I don't do this, pagination of my IR won't save, but at the same time the page scrolls up by itself, which is very unlikely for users. Moreover, the pagination resets after any dialog window appears.
I've tried to find solution in Google, but all is in vain. I hope that somebody knows if there is any workaround in my case (against the scrolling up at least).
I use Oracle Apex 4.2.6.00.03 and application is executed mainly through Mozilla Firefox. The code I wrote for my page 500 is written below in the current post.
On the page load executes the process with PL/SQL lines like this:
:P500_MAIN_ID := APEX_UTIL.GET_NUMERIC_SESSION_STATE(P_ITEM => 'P500_MAIN_ID'); --receiving the chosen row's ID saved in session
The main report region header contains the following script:
<script>
$("#rep_main").find("table.apexir_WORKSHEET_DATA td).live("click",function(){
var chosenOne = $(this).find("span").attr("id"); //finding ID of the chosen row
chooseMAIN(chosenOne);
apex.submit({set:{'P500_MAIN_ID':chosenOne,'P500_CHILD_ID':null}});
});
</script>
In this code P500_CHILD_RN is the item for saving ID of child report's row and the function chooseMAIN is:
function chooseMAIN(docID){
$.post('wwv_flow.show',
{'p_request' : 'APPLICATION_PROCESS=SET_MAIN',
'p_flow_id' : $v('pFlowId'),
'p_flow_step_id' : $v('pFlowStepId'),
'p_instance' : $v('pInstance'),
'x01' : docID},
function(data){
//for the opportunity to get the ID in pure JavaScript
$("#P500_MAIN_ID").val(docID);
$("#P500_CHILD_ID").val("");
$("#rep_main").trigger('apexrefresh');
$("rep_child").trigger('apexrefresh');
}
);
}
The process SET_MAIN looks this way:
begin
APEX_UTIL.SET_SESSION_STATE(P_NAME => 'P500_CHILD_ID',P_VALUE => NULL);
APEX_UTIL.SET_SESSION_STATE(P_NAME => 'P500_MAIN_ID',P_VALUE => APEX_APPLICATION.G_X01);
end;
p.s. Earlier I asked some help with IR here, but I still haven't found proper solution (except making a submit, which has its side effects I said about).
what you really want to use in this case is the FOEX plug-in because its AJAX based so you don't need to submit.
FOEX website
And do yourself a favor and move away from 4.2 you'll thank me later..
Related
I'm hoping to select a particular Region to highlight on the page load based on the link the user follows to get to that page. This is a drill-down report with multiple options, so the goal is to have all options available but focus on the one the user selected to reduce the number of times a user has to navigate to/from the base report to the drill-downs.
Currently, I'm trying to implement this solution https://svenweller.wordpress.com.../, further explained in an Oracle Community discussion here: https://community.oracle.com/..., but it is not working for me.
What I have now is similar to what is shown in those examples, and for now I'm just trying to link to a static Region Display Selector (RDS) tab (the goal will be to have the selected Region be dynamic based on which link is clicked in the feeder page, but I'm clearly not there yet).
I have a Dynamic Action set to fire on Page Load event, and a True action that executes JavaScript code and uses the JavaScript in the example (both with and without the Timeout function suggested in the Oracle thread). I have set Static IDs for the RDS and Region, but when I load the page the RDS still defaults to Show All (or the first region if Show All is off).
Can someone help me understand what I'm doing wrong?
Thanks.
let sesStorage = apex.storage.getScopedSessionStorage({
useAppId:true,
usePageId:true});
setTimeout(sesStorage.setItem( "tabs.activeTab", "#R3" ) { apex.region("tabs").widget().aTabs("getTabs")["#R3"].makeActive();}, 300);
\\version without setTimeout
let sesStorage = apex.storage.getScopedSessionStorage({
useAppId:true,
usePageId:true});
sesStorage.setItem( "tabs.activeTab", "#R3" );
I have done something like this in the past. Create a hidden variable on the page P1_TEST, make sure to set the value not to be protected.
You will need to set the value of that variable when the link is clicked.
Then you need to add static IDs TAB1, TAB2 etc. to the tabs of you region display selector.
Then add a DA on Page Load:
if (apex.item("P1_TEST").getValue() === "Value1"){
$(".apex-rds [href='#TAB1']").trigger('click');
} else if (apex.item("P1_TEST").getValue() === "Value2"){
$(".apex-rds [href='#TAB2']").trigger('click');
}
I have an select dialog. For performance reason, I have kept growing threshold as 100 records, out of 2000 total records.
So, the user can see 100 records when popovers open. I had written growingScrollToLoad so that when the user scrolls down, another 100 records get loaded.
However, this is not working somehow. Popover only shows 100 records initially, and even if I scroll down it doesn't load more data. I am not sure what am I doing wrong. I had tried using all the tags/properties describe in SAPUI5 Guidelines. Also, it works in https://sapui5.hana.ondemand.com/#/sample/sap.m.sample.SelectDialog/preview
<SelectDialog confirm="handleConfirm"
growingThreshold="100"
growingScrollToLoad="true"
items="{myModel>/AllData}"
multiSelect="true"
noDataText="No data"
liveChange="handleSearchOnDialog"
title="Choose"
autoAdjustWidth="true">
<StandardListItem id="idItemA"
description="{Name}"
iconDensityAware="false"
iconInset="false"
title="title"
type="Active"/>
</SelectDialog>
Please look at the API:
https://sapui5.hana.ondemand.com/#/api/sap.m.SelectDialog
You will notice growingScrollToLoad is not listed in the property section of sap.m.SelectDialog ==> you cannot use this functionality
The property growingScrollToLoad is a property of sap.m.ListBase. So if you want to use it you need to create a custom dialog that has a sap.m.List or any other child of sap.m.ListBase as content.
(sap.m.SelectDialog is a direct child to sap.ui.core.Control -> no direct relation to sap.m.ListBase)
I found a solution without changing control.
In XML file, I provided growingThreshold="100" growing="true" to Select dialog. In controller file, for onOpen event of Select dialog, I have written this piece of code:
var sGrowingThreshold = this._oSelectDialog.getGrowingThreshold(); //sGrowingThreshold will be 100
if (sGrowingThreshold)
{
this._oSelectDialog.setGrowing(sGrowingThreshold);
}
It worked and loads data everytime I scroll down till the end.
At this moment I'm working on an Oracle Apex page, which as one Interactive Report (let it have id my_report) and two checkboxes P1000_FLAG_1 and P1000_FLAG_2, which are related to the former and which help me to select some part of the IR's query. Since Apex doesn't suppose checkboxes to make a submit (what isn't right for radiobuttons), I wrote the Javascript function as a workaround:
/* On change any checkbox */
function toggleQuery(nFlag){
if(!(nflag > 0 && nFlag < 3)) return;
sFlag = "P1000_FLAG_" + String(nFlag);
var nChecked = (document.getElementById(sFlag + "_0").checked ? 1 : 0);
apex.submit({set:{sFlag:nChecked}});
}
Also I have one process, which executes on load of my page:
/* Process: On Load — Before Header, Once Per Visit Page */
begin
--initiating several hidden values,
--which are not changed during working with the page
:P1000_HIDDEN := GET_HIDDEN(1);
--...here goes the code, which fills other hidden items...
--
--this piece stands for the default choice in current page
if :P1000_ENTERED is null then
:P1000_FLAG_1 := 1;
:P1000_FLAG_2 := 0;
else
:P1000_FLAG_1 := nvl(:P1000_FLAG_1,0);
:P1000_FLAG_2 := nvl(:P1000_FLAG_2,0);
end if;
:P1000_ENTERED := 1;
end;
My page works perfectly, when I make only choice by means of the checkboxes. But I have a problem, when I execute one action, which works with the help of AJAX callback and ends with this jQuery command:
$("#my_report").trigger('apexrefresh'); //there is only changing some styles (.css(...)) bound to IR refresh
When I open my page for the first time, do my action and then try to check the second checkbox (which is not checked by default), Apex behaves like I've opened the page again for the first time. I realised this, when I had tried to make all my hidden items unprotected (otherwise I got a error of trying to alter protected hidden items manually).
Thus my question is this: what should I do to make my page work correctly? I use Oracle 11g, Apex 4.2.6.00.03
Like Jeffrey said, you can refresh your IG with a dynamic action.
But don't forget to set the items to submit next to your SQL. After the place that you wrote your SQL there is a field "Items to submit", you need to put all items that you are using in your SQL in this field.
After this you can create a dynamic action to refresh the report when some item change.
I'm using APEX 5 page to show a classic report region, I want to hide this region when no data found.
I used javascript code in Page HTML Header but it's not working:
<script type="text/javascript">
var has_rows = document.getElementById('news_region').rows;
if (has_rows==0){
$("news_region").hide();
}
</script>
Well, a simple option is to use region's "Server-side condition" whose type is "Rows returned", while the SQL query is just the same as report region's query.
It works OK, no doubt in that, but I don't know it'll behave when the query is heavy (returns a lot of rows, selects from huge tables and stuff). Though, I presume it won't cost much to try it.
I am building a web-based tool for the role-playing game GURPS. Data is maintained in several XML files that are loaded into arrays. Based on changes the user makes, data is re-populated into various spans, inputs and dropdowns from the arrays. No problem so far.
To give the user more feedback, I have a added an anchor that does a hover pop-up that shows the details of the current weapon. For the initial coding, these values were hard-coded while I worked out the rendering issues. Still no problems yet.
Now I am trying to actually populate the hover pop-up with real data. I can not get it to load the real data into the span! I have debugged the function and am certain that I have extracted the data I want. I have used similar lines of code to populate other parts of the web page.
Specifics: I want to replace the "aa" in the span below:
<span id="weaponName1" name="weaponName1" class="weaponName">aa</span><img src="Images/Firearms/Makarov_Suppressed.jpg">
The code I am using to try to re-populate the span is:
function loadWeaponStats(person, weaponID) {
// Load stats of the current weapon into the "Details" anchor fly-out
for (xx1=0; xx1<WeaponsArray.length; xx1++) {
if (weaponID == WeaponsArray[xx1][0]) {
weaponName = WeaponsArray[xx1][1];
alert("weaponName: "+weaponName+"\nperson: "+person);
$("#weaponName"+person).val(weaponName);
xx1 = WeaponsArray.length; // Kill the loop
}
}
}
The alert() is simply to confirm that I have the correct data. The following line should re-populate the span, but it does not.
All HTML, CSS & JavaScript can be found at GURPS Combat Calculator
Pulling out what little hair I have left.
Thanks
You can also do as below:
$("#weaponName"+person).text(weaponName);
you can't use Val() method here.