Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a left nav with StaticDisplayLevels="3". I want to expand the navigation of only current sites.

Expected result:

> Inactive1
> Inactive2
> Current
    > Current's SubSite1
    > Current's SubSite2
> Inactive3

Actual result:

> Inactive1
    > Inactive1's SubSite1
    > Inactive1's SubSite2
> Inactive2
    > Inactive2's SubSite1
> Current
    > Current's SubSite1
    > Current's SubSite2
> Inactive3
    > Inactive3's SubSite1

Control:

<PublishingNavigation:PortalSiteMapDataSource
    ID="rightSiteMap"
    runat="server"
    EnableViewState="false"
    SiteMapProvider="GlobalNavigation"
    StartFromCurrentNode="true"
    StartingNodeOffset="1"
    ShowStartingNode="true"
    TrimNonCurrentTypes="Heading"
/>

<SharePointWebControls:AspMenu
    ID="TopNavigationMenuV5"
    EncodeTitle="false"
    Runat="server"
    EnableViewState="false"
    DataSourceID="rightSiteMap"
    UseSimpleRendering="false"
    UseSeparateCss="false"
    Orientation="Vertical"
    StaticDisplayLevels="3"
    MaximumDynamicDisplayLevels="0"
    StaticMenuItemStyle-CssClass="right_menu_table"
    CssClass="right_menu_links"
    StaticSelectedStyle-CssClass="table_right_menu_active"
    SkipLinkText=""
/>
share|improve this question
add comment

2 Answers 2

This is not Out-Of-Box behaviour in SharePoint. To achieve this you'll have to use some javascript that will hide the menuitems if the parent does not have the selected class.

I use the jQuery library to achieve this (easier way to write javascript)

Example:

$(document).ready(function () {
    // Hides all non-toplevel menu items in the quicklaunch
    $("#s4-leftpanel UL.root > LI.static").children("UL").hide();
    // Shows sublevet menu items for selected toplevel in the quicklaunch
    $("#s4-leftpanel UL.root > LI.selected").children("UL").show();
});

The above examples is made by using the default SharePoint 2010 css classes.

Hope this helps :)

share|improve this answer
    
Thanks for the jQuery solution. But I don't have LI and UL in the DOM. The menu is created with a complex nested tables. Is there a way to located those TRs? –  vulcan raven Oct 14 '12 at 20:53
    
@vulcanraven What SharePoint version are you using? –  Daniel Ziga Oct 14 '12 at 21:03
    
2010 Enterprise. –  vulcan raven Oct 14 '12 at 22:58
add comment

I'm not sure but maybe you could try to use a different Site Map Provider. There are many providers you can check on internet for more.

So instead of SiteMapProvider="GlobalNavigation" you can use another one.

It is just a thought.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.