IR Refresh Instead of Page Refresh when Model Dialog Close / Restore screen position after refresh

 A) IR Refresh Instead of Page Refresh when Model Dialog Close 

https://apex.oracle.com/pls/apex/f?p=90922:18

1) Save function as refreshCurrent.js 

function refreshCurrent(pRegionId){

  var lReportId = "#"+pRegionId+"_ir";

  /** @purpose retrieve the current min row of an IR by parsing the pagination label of an "X - Y" or X - Y of Z" scheme.

    *@param IR id

    */

  function getCurrentPagination (pReportId) {

    var currentText = apex.jQuery(".a-IRR-pagination-label", pReportId).text()

      , currentMinRow = currentText.substring(0, currentText.indexOf("-")).trim();

    return currentMinRow;

  };

  

  /** @purpose paginates the IR with the indicated settings 

    * @param pRegionId IR id

    * @param pMinRow row to start the pagination at

    * @param pMaxRows irrelevant. This is not parsed anywhere. 

    * @param pRowsFetched irrelevant. This is not parsed anywhere. Rows to be fetchedd is determined serverside by minrow + rows displayed

    */

  function paginateIR (pReportId, pMinRow,pMaxRows,pRowsFetched){

    var fakeButton = apex.jQuery("<button>"

                     , { attr: { "class":"a-Button a-IRR-button a-IRR-button--pagination"

                               , "data-pagination":"pgR_min_row="+pMinRow+"max_rows="+pMaxRows+"rows_fetched="+pRowsFetched

                               }

                       , css: {"display":"none"} 

                       }

                    ).click(function(e){ e.preventDefault(); });

    apex.jQuery(pReportId).append(fakeButton);

    fakeButton.click();

    fakeButton.remove();

  };

  

  // maxrows and rowsfetched are irrelevant. 

  paginateIR(lReportId, getCurrentPagination(lReportId), 1, 1);

};



2) Add the  refreshCurrent.js  file as Static Application File (Go to Share Components) 


3) Got o User Interface of Application --> JavaScript Tab --> Add File URL i.e #APP_IMAGES#refreshCurrent.js


4) Define the Static ID of Interactive Report  i.e ITEM_DTL

5) Create DA on Interactive Report --> 


Event : Dialog Closed

Selection Type : Region

Region : Interactive Report Region


Action : Execute Java Script 


Code: refreshCurrent('ITEM_DTL');


B) Restore screen position after refresh



Restore screen position after refresh

:https://rimblas.com/blog/2016/09/video-005-save-screen-position-after-refresh/

1) Add a JavaScript variable to your page (use the “Function and Global Variable Declaration” field). We’ll use it to remember our scroll position.

var savepos;

2)Add a DA on click of the link used to invoke a modal page. It will save the current scroll position, so call it “Save Scroll Position”

a) define class on Link Coloumn of Report  (Assume You have Item_Code column which having link type )

Link--> Link Attributes = class="editRecord"

b) Create DA on Click of jQuery Selector (.editRecord)

   Execute Java Script Code
savepos = $(window).scrollTop();

3) Create an “After Refresh” Dynamic Action to restore the postion.( On Interactive Report)

$(window).scrollTop(savepos);

Comments

Popular posts from this blog

Telegram Integration with Oracle

The username or password for the connection pool named |apex||, are invalid, expired, or the account is locked

Enabled SQL Developer Web (SDW) & ORDS Database API ORDS 19.4