Obtaining Tab Panel Unique ID from "Whenever Shown" actions

We had a script written to update the URL of the page to the TabID so that when the user hit refresh it would reload the page.   With the introduction of the actions now on the TabSet, this has failed so we are trying to rework this code into the new Actions screen.

My question…  How do I obtain the TabID so that I can update the HREF with the bookmark when calling a snippet from the Whenever Shown action?

This is the call that we used to have working, when we registered the tab click event. 

window.history.replaceState(null, “Offender Profile”, “Offender_Template?id=” + id + “#” +tabId )  

Thanks you in advance

Here’s the easiest way to do it: add an Inline JavaScript Resource to the page that subscribes to the “skuid.tabset.onTabShow” event. This will fire when tabs from any Tab Set are shown, but you can filter out the events to limit to just the Tab Set you’re interested in. For example, assuming that the Tab Set you care about has a Unique Id, e.g. “MyTabSet”, you could do this:


   if (e.tabSetComponent.id()===“MyTabSet”) {
      var tabId = e.panel.prop(‘id’);
          “Offender Profile”,
          “Offender_Template?id=” + id + “#” +tabId


I am assuming here that you’ll be populating the id variable through some other means…

“Whenever Shown” snippets are currently passed any context information about the tab or panel that was shown, so you couldn’t do this right now purely using Whenever Shown snippets or actions. We’ll be adding this context information to the Whenever Shown actions in a future release.

Worked like a charm!  Thanks Zach.   I forgot about subscribing to the event.