Wednesday, 9 December 2015

There are no items to show in this view of the list. Customize default message using content Editor Webpart in SharePoint

When a list or library does not have any items in it, a message will display in the view as in the screenshot.


If you want to customize the message, just add the below scripts in content Editor web part and Save the page. 

Go to the page where you have placed the list which you want to modify, Site Action-> Edit Page->select add a web Part->choose Content Edit Web Part. then you need to add the following sample code in Source Edit.

<script>
function ChangeEmptyLibraryMessage()
{
  var a = document.getElementsByTagName("TD")
  for (var i=0;i<a.length;i++)
  {
    if (a[i].className=="ms-vb")
    {
      a[i].innerHTML = "There are no items to display here.";
    }
  }
}
_spBodyOnLoadFunctionNames.push("ChangeEmptyLibraryMessage") 
</script> 

The shaded message will show in the place of default message.


The above script will be for that particular page where you have placed it.

If you want to change the default message in all list in the site, open the Default.apsx page in SharePoint Designer search for “There are no items to show in this view of” text in the code and replaced the text with the message you want to display. This will work for all lists and calendar events.