Aras Innovator – Show Tab By Classification 透過javascript控制頁籤的顯示

,

於Form表單開啟時或是特定欄位值變更後,觸發Client Method。

function showTabByClassification() {
	if (!parent.relationships) {
		setTimeout(showTabByClassification, 30);
		return;
	}
	var tabbar = parent.relationships.relTabbar;
	if (parent.relationships.document.readyState !== "complete" 
	|| !parent.relationships.relTabbarReady
	|| parent.relationships.relTabbar.GetTabOrder("|")===""
	|| !parent.relationships.currTabID) {
		setTimeout(showTabByClassification, 30);
	} else {
		var tabID = null;
		tabID0 = tabbar.GetTabId("Workflow Sign-Offs");
		tabID1 = tabbar.GetTabId("Parts");
		tabID2 = tabbar.GetTabId("Documents");
		tabID3 = tabbar.GetTabId("Attachments");
		if (classification === "Class A") {
			tabbar.SetTabVisible(tabID1, true);
			tabbar.SetTabVisible(tabID2, true);
			tabbar.SetTabVisible(tabID3, false);
		}
		else if (classification === "Class B") {
			tabbar.SetTabVisible(tabID1, true);
			tabbar.SetTabVisible(tabID2, true);
			tabbar.SetTabVisible(tabID3, true);
		}
		else {
		    tabbar.selectTab(tabID0);
			tabbar.SetTabVisible(tabID1, false);
			tabbar.SetTabVisible(tabID2, false);
			tabbar.SetTabVisible(tabID3, false);
		}
	}
} 
setTimeout(showTabByClassification, 30);

留言

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.