Wednesday, November 7, 2012

Removing a document/list web part from a page if the list is empty

I have a web part page which has a few document web parts - the web parts have filters applied so they only show relevant items to that particular user.  However, sometimes there are no items to show, and then the user is shown a box with nothing in it, apart from a typical SharePoint message about how there are no items.  This can look a bit messy.

I finally found a solution, posted by Mike Smith (of Mike Smith's Tech Training Notes), which uses JavaScript to remove the empty web part.  If I had spare time, I would rewrite this in jQuery (as everything else on my SharePoint environment is in jQuery), but it's perfectly functional as it is now.  Thanks Mike, you're a star!

No comments:

Post a Comment