PiggyInTheMirror
PiggyInTheMirror

Reputation: 77

Getting free of scrolling up after submit in Oracle Apex

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).

Upvotes: 0

Views: 1256

Answers (1)

GasparYYC
GasparYYC

Reputation: 188

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..

Upvotes: 0

Related Questions