RemcoVanOosterhout - Monday, June 8, 2015 7:25 AM:
I'm working on the following:
Depending on one condition or another, I want to be able to show, say, the third relationship tab of a form rather than the tab with index 0 (or the lowest sort order) when opening a document form client side.
So far I've been able to recover the ID of the tab currently (and defaultly) shown, yet I haven't been able to display the third tab rather than the first. I haven't been able to find a method to display a tab with a certain index/ID/name/whatever. What am I overlooking?
Jeroen Bosch - Monday, June 8, 2015 8:41 AM:
Hi Remco,
please have a look at www.aras.comhttp:/.../867.aspx
I didn't succeed to use SetTabVisible while SetTabEnabled works great.
I suspect a "bug" somewhere in SetTabVisible.
Hope it helps and please keep the community posted about you findings.
Jeroen
RemcoVanOosterhout - Monday, June 8, 2015 9:04 AM:
Dear Jeroen,
The problem doesn't have to do with visibility or enabling a tab. Toggling the visibility of a tab only affects whether the tab is visible on the form or not, not whether the tab is displayed at any given point in time or not. I do not want to hide any tabs for my users, I just want to show them a specific tab (which may vary depending on a set of conditions) whenever they open the form.
Edit: I solved the problem this morning, using bits from the standard Aras "ItemType Form onload" method. Below is the result:
//Method: cof_Document_ShowStarterTab
//Fired on: onAfterPopulate
//Author: Remco van Oosterhout, Cofely Energy & Infra
//This: Document
//Method ensures that the user is shown a specific tab when opening a document form
//The tab shown depends on the current state of the document
top.system_ItemTypeHideTabs = function ()
{
// Used as onload event for ItemType Form.
// Make sure there is a relationships frame
if (!parent.relationships)
{
setTimeout("top.system_ItemTypeHideTabs();", 100);
return;
}
// If the document isn't ready, wait a bit and try again
if (parent.relationships.document.readyState != "complete" || !parent.relationships.currTabID){
setTimeout("top.system_ItemTypeHideTabs();", 100);
}
else{
var thisState = this.item.getElementsByTagName("state");
var thisStateString = thisState[0].text;
var tabIds = parent.relationships.relTabbar.getTabOrder('|');
var a = tabIds.split('|');
//Select the index of the desired tab
if (thisStateString === "Released"){
index = 3;
}
else{
index = 1;
}
// Show the desired tab
parent.relationships.relTabbar.selectTab(a[index]);
}
};
// Wait a bit before starting
setTimeout("top.system_ItemTypeHideTabs()", 200);