List view selector missing with multiple web parts in SharePoint 2010

I was asked to look into an issue on a SharePoint 2010 site that my users had been working with regarding strange behaviour with the navigation controls in various lists that they had created. This post describes a bug (or feature, take your pick!) where the list view selector control in the title area of a page disappears if there are multiple web parts on the page. First for a bit of background information.

Breadcrumb Navigation

SharePoint 2010 has an updated look and feel from previous versions. For the most part this is a fantastic update that I’ve seen many users find a welcome change. The biggest hurdle is more often than not related to how familiar or open users are to the introduction of the ribbon into SharePoint.

By introducing the ribbon, which contextually changes dependent upon the content being viewed, some modification was required to the how navigation is presented in a SharePoint site – hence the browse tab on the ribbon. The browse tab shows the site title and site logo, plus it now also shows the site path. The starting node of the site path is dependent upon the individual navigation settings of a site.

SP2010 Title Area Site Path

By showing the site path in the title area we now have a breadcrumb that the user can access. What about the sites that are choosing not to show the full path, or for situations where the title area is hidden (because it is in the browse tab of the ribbon!)? Well, there is a new breadcrumb control that is shown as a ‘pop-up’ by clicking the little folder icon at the top of the page.

SP2010 Breadcrumb Control

List View Navigation

With the introduction of the ribbon and the replacement of the list toolbar (see my previous post on how to show the list toolbar in 2010) it is now potentially harder to navigate between list views. The ability to do so is available in the List tab of the ribbon, but we are seemingly introducing an additional number of clicks to get there than was required in 2007.

SP2010 Ribbon List View Selector

In order to make the navigation between views easy the title area breadcrumb that we mentioned earlier has a great feature where, when you are viewing a list, the last node of the breadcrumb becomes a List View Selector.

SP2010 List View Selector

It is with this list view selector control that my users had reported the strange behaviour of it being present on some lists and not on others. After a little bit of investigation it became clear that the deciding factor in if the list view selector was shown was if the users had edited the list view page (not the view itself) and added any additional web parts – a perfectly valid thing to do in SharePoint 2010. After they had added a web part to the view then the list view selector disappeared to be replaced by a much less functional breadcrumb:

SP2010 Title Area Site Path Missing

Unfortunately after discovering this, and digging deeper as to why it happens, the conclusion is that this is out of the box functionality and it is currently not possible to have the list view selector control on a list view page with more than one web part.

The Reason

After seeing the behaviour described above I dug a little deeper into trying to discover why this happened, with the hope of being able to overcome it. Looking at a list view page in SharePoint Designer I could see that the list view control was specific to the page used to generate the list view, i.e. the PlaceHolderPageTitleInTitleArea placeholder was being overwritten to display a control called ListTitleViewSelectorMenu as shown by this code excerpt:

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
	<SharePoint:ListProperty Property="TitleBreadcrumb" runat="server"/>
	<SharePoint:UIVersionedContent UIVersion="4" runat="server">
		<ContentTemplate>
			<span class="ms-ltviewselectormenuheader" runat="server">
				<SharePoint:ListTitleViewSelectorMenu AlignToParent="true" id="LTViewSelectorMenu" runat="server" />
			</span>
		</ContentTemplate>
	</SharePoint:UIVersionedContent>
</asp:Content>

Wanting to investigate further I got a quick lesson in using Reflector from my colleague Stuart Starrs (@starznet) and took a look at the ListTitleViewSelectorMenu in more detail. As you can see from the screenshot there is actually a hard-code check to only show the control if it is the only web part on the page!

List View Selector Reflector

I can’t actually think of a scenario where this would be desirable, but the check has been deliberately put in there so I assume there must be a good reason for it! Unfortunately this leaves us with the poor choice of having the list view selector or having multiple web parts on the page – not both.

share and enjoy
  • Print
  • Twitter
  • Digg
  • del.icio.us
  • StumbleUpon
  • Yahoo! Buzz
  • Google Bookmarks
  • Facebook

7 comments to List view selector missing with multiple web parts in SharePoint 2010

  • Vladimir Zak

    I discovered same problem in my SP 2010 after migration from WSS 3.0. I have additional content parts in some list views for adding some JS. I have no idea what to do to guarantee same functionality in my pages and to have list tools visible and list view selector visible:(

    • Yes it’s a real shame, especially as I can’t think why they need to check for the page only having one web part anyway. In your scenario perhaps you could add the JS files into a custom master page so that you don’t need additional web parts on the page. Or possibly see if you could inject that JS another way – maybe via a custom action?

  • I think the behavior makes sense. If you have more than one Web Part, how would tell which Web Part the selector applies to?

    You can always edit the Web Part and choose to display the full toolbar. This will include the selector, exactly the same way it is displayed in SP 2007.

    • Hi Christophe,

      If there were multiple list view web parts on the page then sure it could be confusing. But it’s just as likely that there are other non-list view web parts on the page (e.g. a content editor wp with related text) in which case I think the list view selector still has value.

      Agreed that the old style toolbar can be used in this scenario, but this could be inconsistent with the rest of a site – and it’s a shame to have to make a compromise at all!

      Ta

  • [...] bug,” is that you’ve now lost your view menu in the breadcrumbs. (Glyn Clough provides more information about this issue. And Pentalogic has a free solution that fixes the issue on all pages, but may be [...]

  • [...] not a bug,” is that you’ve now lost your view menu in the breadcrumbs. (Glyn Clough provides more information about this issue. And Pentalogic has a free solution that fixes the issue on all pages, but may be [...]

  • Richard Shaw

    Glyn,
    I wasn’t sure if this was still an issue that needed resolving. I was able to programmatically set the default web part using JavaScript in the Content Editor Web Part in one of 2 ways:

    First way: (tested on my site and this works)

    setTimeout(function() {
    var elem = document.getElementById(“MSOZoneCell_WebPartWPQ2″);
    if(elem != null) {
    var dummyevent = new Array();
    dummyevent["target"] = elem;
    dummyevent["srcElement"] = elem;
    WpClick(dummyevent);
    }
    }, 100);

    Second way: (this is shorter that the first)
    ExecuteOrDelayUntilScriptLoaded(init_defaultWP, “sp.ribbon.js”);

    function init_defaultWP(){
    setTimeout(function(){
    var defaultWP = document.getElementById(“MSOZoneCell_WebPartWPQ2″);
    WpClick({target:defaultWP,srcElement:defaultWP});
    },100);
    }

    In both cases, the MSOZoneCell_WebPartWPQ2 being my list view web part.

    I hope that helps.

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>