I have read several post with great interest especially (https://svenweller.wordpress.com/2018/11/27/apex-quickie-set-region-display-selector-dynamically/),
because I have to solve exactly this problem when developing an application.
I use APEX version 19.2 and I like to have the following behaviour.
The application should store the last tab when leaving the page and select this when reopening the page.
In several cases I want to select a special tab when opening the page.
I have tried different solutions I have found at the forum, but all of them got the same problem:
APEX activates a tab in the region display selector when the page is opened.
Either the first or if "Remeber last Selection" is set the last active tab and this seems to run after the action in "Page Load".
The tab I selected in the application is marked with a frame, but selected and the content is displayed from the tab selected by APEX.
If you follow this in the debug view of the browser, you can see that the tab selected by the application is briefly set as acticeTab, but is then immediately overwritten with the APEX value.
The problem can be simulated quickly by creating a page with a Region Display Selector and set the activeTab on Page Load the using the following code.
let sesStorage = apex.storage.getScopedSessionStorage ({
useAppId: true,
usePageId: true});
sesStorage.setItem ("DEMO.activeTab", "# REGION3");
sets or simulates the click on the tab in the page load
// choose target region via region display selector
// static id = "REGION3"
$ ('# REGION3_tab a'). Trigger ('click');
It is irrelevant whether the code is stored in the "Execute at Page Load" section of the page or as Dynamic Action on Event "Page Load"
Unfortunately, both variants lead to the behavior I have described.
I don't know if there is an event where I could place the Javascript code and which will definitely be executed after the APEX internal action.
Thank you very much for your support!
Sincerely yours
Peter Rademacher.