only be hidden using unsupported JavaScript.
I saw a few threads on the net which use document.getElementByTagName(“LI”) and traverse
the collection to hide the desired item.
The problem with that approach is the crmForm contains a lot of LI items which causes a performance hit on the page each time it loads.
The following code uses a much more direct approach which drills directly to the navigation
bar Group ( Details , Marketing , Sales , Service ).
Paste the code inside the entity onload event.
var Display =
{
Show : "inline",
Hide : "none"
}
var NavGroup =
{
Details : "_NA_Info",
Sales : "_NA_SFA",
Service : "_NA_CS",
Marketing : "_NA_MA"
}
function OnCrmPageLoad()
{
ToggleNavigation( NavGroup.Details , "Workflows" , Display.Hide );
ToggleNavigation( NavGroup.Marketing , "Campaigns" , Display.Hide );
}
function ToggleNavigation( group , item , display )
{
try
{
var navGroup = document.getElementById( group );
if( !navGroup ) return alert( "Navigation Group is missing" );
for( var i = 0 ; i < navGroup.nextSibling.childNodes.length ; i++ ){
var menuItem = navGroup.nextSibling.childNodes[i];
if( menuItem.childNodes[0].childNodes[1].innerText == item )menuItem.style.display = display;
}
}
catch( err )
{
//alert( "Navigation Item " + item + " is missing" );
}
}
OnCrmPageLoad();
4 comments:
Thanks, works great !
This is very nice however I wish it worked with custom entities as well!
Thanks!
Hi..How can i do similar thing in a plugin? I dont want to use javascript. Plz let me knw.
Hi,
I often use your blog as for various enchancement with javascript. Thanks!
Maybe this snipet could be better if it would adressed multilanguage features - now it searches by a button name, which is different in different languages.
Post a Comment