Show the webpart tabs on a SharePoint 2010 page when you have multiple webparts

Probably the last blogpost of the year 2012, but I didn’t want to keep this small jquery gem on how to get back the webpart tabs from all SharePoint 2010 users.

Problem when adding multiple webparts: losing view and webpart tabs

From time to time, you have a page with multiple webparts and you lose track of some key elements from your header. What if you are in a, for example, document library and you have an extra webpart there, like a content editor with some remarks on the documents. You lose the webpart tabs and the views.

This is a normal library where we can see the view selector and the tabs:

normal library with view selector and tabs
normal library with view selector and tabs

But if we edit the page and add a content editor webpart, where we add some text, a funny thing happens. You lose the view selector and the documents and library webpart tabs are gone! You can get them back by clicking somewhere in the webpart or on the browse tab.

multi webpart loses the view selector and webpart tabs
multi webpart loses the view selector and webpart tabs

How can we fix the views and webpart tabs in the ribbon ?

On how to fix the views I already covered in this blogpost where I talk about the free add-on ViewRescue from Pentalogic.

But how can we fix the tabs ?

A quick google Bing around the interwebs brought me to this question/answer on StackOverFlow where Hans Thorsten gave this piece of jquery as an answer:

$(document).ready(function() {
    var target = document.getElementById("MSOZoneCell_WebPartWPQ2");
    if(target != null) {
        var fakeEvent = new Array();
        fakeEvent["target"] = target;
        fakeEvent["srcElement"] = target;

What this code does is trigger the build-in WpClick event, which is triggered when you click somewhere in the webpart. At my client, it didn’t always work however, probably due to loading time issues.

What did help (but not fix it completely) is adding a $.delay(2000) to the code.

About: Marijn

Marijn Somers (MVP) has over 14 years experience in the SharePoint world, starting out with SP2007. Over the years the focus has grown to Office 365, with a focus on collaboration and document management. He is a business consultant at Balestra and Principal Content Provider for "Mijn 365 Coach" that offers dutch employee video training. His main work tracks are around user adoption, training and coaching and governance. He is also not afraid to dig deeper in the technicalities with PowerShell, adaptive cards or custom formatting in lists and libraries. You can listen to him on the biweekly "Office 365 Distilled" podcast.

%d bloggers like this: