Friday, November 25, 2022

APEX 22.2 Clear Active Tab

From APEX version 22.2 there's a changed behavior how active tabs or region display selectors (RDS) are stored in the browser session storage:




In versions before 22.2 they were stored without a prefix (session storage scope) and now they are stored with the prefix ORA_WWV_apex.apexTabs.

In some of my applications I've used a custom JS function to clear active tab:

/**
* Clear Active Tab
* @param {number} pPageId - Page Number
* @param {string} pRegionId - Region Static ID
*/
function clearActiveTab(pPageId,pRegionId){
var vStorage;
if (apex.storage.hasSessionStorageSupport()) {
vStorage = apex.storage.getScopedSessionStorage({
useAppId: true
});
vStorage.setItem(pPageId+'.'+pRegionId+'.activeTab', null)
}
}


From APEX 22.2 you need to set prefix:

/**
* Clear Active Tab
* @param {number} pPageId - Page Number
* @param {string} pRegionId - Region Static ID
*/
function clearActiveTab(pPageId,pRegionId){
var vStorage;
if (apex.storage.hasSessionStorageSupport()) {
vStorage = apex.storage.getScopedSessionStorage({
prefix: 'ORA_WWV_apex.apexTabs',
useAppId: true
});
vStorage.setItem(pPageId+'.'+pRegionId+'.activeTab', null)
}
}





Tested in APEX 22.2.0