I would like to add an item to the context menu using a GUI extension which links directly to a tab in a view.
A good example was in an older version of SDL Tridion. There was a link to the "Info" tab for components in the context menu which opened the component view directly on the "info" tab.
Is it possible to recreate this, and if so are there any samples on how to link to a specific tab?
I tried adding the following JavaScript to my tab.js:
var tabname = $url.getHashParam("tab")
if (tabname != '') {
if ($j('#' + tabname)) {
$j('#' + tabname).focus();
}
}
This code fires correctly, except the tab never gets selected. Is there a method which actually selects the tab?
I'd say you'd need to write two parts:
I think there are quite some examples of passing parameters from a command to its popup already, so will focus on #2.
When you see tabs in a Tridion GUI, they are typically part of a Tridion.Controls.TabControl
. If you have JavaScript that runs within your popup, you can get all tab controls with this snippet:
var tab = $controls.getControl($("#MasterTabControl"),
"Tridion.Controls.TabControl");
Then we just need to select the correct tab on it:
tab.selectItem('InfoTab');
Where InfoTab
is the tab we want to focus and thus the parameter you're passing into the popup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With