Monday, 14 July 2014

APEX Theme 25 -> Region Container template

Implementation of "Close all" container functionality

Workaround on how to get it work

I am sure that we all discovered and needed to use Theme 25 Page Region Container Template at some stage. 

For many reasons I found this functionality very useful in many situations but especially when combined with show and hide regions.


But have you ever wondered why there wasn't an option to Close All tabs in a container. I mean there is an option to Show All or show each of them individually but why don't we have a Close All option so that we can Close All tabs if we wanted to. After a few apps and client requests this became a nice to have feature in my apps and here is my proposed solution to get this working.

Simply by adding this JavaScript into your page your Close all option should be there. 
function markActive()

jQuery(function( $ ) {

//implement close all sub tabs button
//find last element of tabs and add close all
$('div.uFrameRegionSelector ul li').last().after('<li><a id="CLOSEALL" class="" href="javascript:markActive();"> <span>Close All</span><li>');

});//end jquery
I am sure there are many other ways to do the same but just hope I was able to help some of you looking for similar solutions.