Tuesday, April 29, 2014

Apex - Clear a page when a tab is clicked.


How to clear a page when a tab is clicked?

Create a new application page process:
  • Navigate to Applications -> Shared Components -> Application Processes
  • Click Create
  • Create a process which runs “On Submit: After Page Submission – Before Computations and Validations”.

In Process Source put the following code:

DECLARE
l_tab_page_no NUMBER;

BEGIN
SELECT tab_page INTO l_tab_page_no
FROM apex_application_tabs
WHERE application_id = :APP_ID
AND tab_name = :REQUEST;

APEX_UTIL.CLEAR_PAGE_CACHE(l_tab_page_no);
EXCEPTION WHEN NO_DATA_FOUND THEN
    NULL;
END;

You can also do a specific Tab page (if you know the Tab name) using:

IF (:REQUEST = 'T_TAB_NAME’) THEN
   APEX_UTIL.CLEAR_PAGE_CACHE(your_page_number);
END IF;

Where T_TAB_NAME is your Tab name.

When you now click a tab, the page's cache will be cleared.

Have a look at Tab names and page # using the following query:
select * FROM apex_application_tabs;

No comments:

Post a Comment