SharePoint 2010 – The view selector is back!

In SharePoint 2010 you loose the list view selector in a list view if there are more than 1 web part in the page. This makes navigating the list views very cumbersome.

I have previously created a solution for adding a view selector in these list views, but that solution was a bit clunky.

I looked at this again today, and came up with a solution for re-enabling the missing list view selector that was clean and simple – and it doesn’t even require jQuery…

This is the first article where I’m using the “SharePoint 2010 Client Object Model”.

This solution is placed in a ContentEditorWebPart (CEWP) somewhere in the page you want the list view menu re-enable in. I recommend using the “Content Link” option in the CEWP as the code might be messed with by SharePoint if you paste it directly in the CEWP’s HTML-source.

To achieve this, put the code in a text-file and place it in a shares document library (all users must have read access), or in a folder created in SharePoint Designer. You then copy the file’s url and paste it into the “Content Link” field in the “Edit web part” panel like this:
IMG

You do not get any pictures of the menu itself as it is no different from the standard list view selector.

Here is the code:
Get the code here

Advertisement

12 Responses to “SharePoint 2010 – The view selector is back!”

  1. Rene Says:

    Perfect timing! Just encountered it yesterday and was wondering if there’s a way to solve this

  2. monkeysoft Says:

    Does Monkeysoft do things like this just to purposely annoy users?

  3. Rajan Says:

    Perfect timing for me too! Just face this issue today. Still need to try on my dev server. But one more issue is that ribbon for list view webpart won’t come up if we have more than one webparts on list view page. So, any idea what we can modify/add to script to make this working?

    Thanks in advance,
    Rajan

    • Alexander Bautz Says:

      Hi,
      Glad you liked it. I’m not entirely sure what you mean by the ribbon not coming up. With more than one list view web part in the page, you need to select one list by clicking on it to bring up the ribbon.

      Alexander

    • Rajan Says:

      Thanks for quick reply Alex.
      I tried your code it works like charm and got my view selector back. :)
      The issue i am talking about, please check my blog for more details. Here i can’t upload images to give you proper explanation.
      Here is the link: http://wp.me/pTOaG-3W

    • Alexander Bautz Says:

      Hi,
      Sorry, but I have no solution to this issue.

      Alexander

  4. List Tools on Ribbon not visible when add more WebParts to List DataSheet view page « Rajan's Blog Says:

    [...] to Alexander Bautz Using his script i am able to solve first issue. But still 2nd issue is present. I don’t know [...]

  5. Hans Worst Says:

    For free: View Rescue for SharePoint 2010
    http://www.pentalogic.net/sharepoint-products/free-sharepoint-web-parts/view-rescue

  6. Liner Says:

    Hello, Looks like the link to the code is broken. Thanks

    • Alexander Bautz Says:

      Hi,
      The redirect from my old to my new server failed. I have updated the link.

      Alexander

  7. Tim Says:

    I get nothing but an error: “document.getElementById(…)’ is null or not an object”

    • Alexander Bautz Says:

      Hi,
      Have the master page been modified?

      Alexander

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 363 other followers