After migrating from MOSS 2007 to Sharepoint 2010/2013, sometimes for some lists/libraries the libraries/list control disappears, this is a fix to adress such issues.

In MOSS 2007, sometimes we added Content Editor Web Part in Allitems.aspx, to add some text or insert some logic/customizations.
However MOSS 2007 version did not have the ribbon control which was introduced from Sharepoint 2010 onwards.
In SharePoint 2010, if you have more than one web part on a web part page, the ribbon disappears because SharePoint doesn’t know which web part to display the ribbon for, because the ribbons are obviously different for the two and SharePoint needs to know which web part to display the ribbon for.
Once you select a web part (by clicking on it) the selected web part will become “active” and the correct ribbon will show up.

To automatically set the correct ribbon,we can use javascript to point the ribbon for the lists/library.

<title>
To automatically set the correct ribbon,we can use javascript to point the ribbon for the lists/library.
</title>
<other>
Add a content editor webpart to insert the below javascript in the allitems page.
Go to Site Actions >> Edit Page and you will see a web part zone where a CEWP can be addedin the page
</other>
function SelectWP(){
//select first webpart
var wp = document.getElementById(“_wpSelected”);
if (wp != null){
wp.value =”MSOZoneCell_WebPartWPQ2″;
SelectRibbonTab(‘Ribbon.Document’, true)
}
}
ExecuteOrDelayUntilScriptLoaded(SelectWP, “sp.ribbon.js”);

Advertisements