I will try and explain this the best I can, I am building a documentation site for our company and have created the following

List called Customer Details that has 4 content type associated with it Content type are as follows ADSL Service Details, VPN Details, Router Details etc

The content types have site columns associated with them for information like Usernames, password, LAN IP, WAN IP etc

I have uploaded the all itmes views for the Customer details list which is grouped by Customer and then by device

I have enabled all the columns for all the content types in the view to show the information needed.

What I would like to do is hide any columns in the view if the column is blank

Content Types All Coumns


Are you using "Boxed" style for this view?

Anyway, you can add a CEWP (Content Editor Web Part) and add some javascript to hide the columns.

About how to use CEWP: http://office.microsoft.com/en-us/sharepoint-server-help/content-editor-web-part-HA010024046.aspx

Core javascript:

<script src="/personalsites/lvjun/Shared%20Documents/jquery-1.10.2.min.js" type="text/javascript"></script>
        //Loop each row of the data
        $(".ms-listviewtable .ms-stylebox table > tbody > tr").each(function(){
            //If the value is blank, hide the whole row
            if($(this).find("> .ms-stylebody").text() === ''){

The way I find out which class to use is by checking the HTML source file manually.

Hope this can help you.

| improve this answer | |
  • 1
    Hey, Yes I am using the boxed view, I am a little unsure on what I need to change in the code above to make it work with the boxed view. If you can help that would be great – Matt Saunders Feb 2 '14 at 6:55
  • Hi @MattSaunders , I think you only need to change the script src to your actual one. No need to change others. Let me know if you hit any issue. – 夏至夕陽 Feb 24 '14 at 1:37
  • Hey, Yes I did that but it did not hide the empty columns – Matt Saunders Feb 27 '14 at 10:58
  • Hi 夏至夕陽 I know I posted this a while ago but I wondered if you could modify the code you posted to get this to work when items are grouped in the boxed style – Matt Saunders Feb 7 '16 at 8:12

Please take a look at this post:
You will need to create or edit your view in SharePoint designer and built in some logic with the XSLT.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.