Answered How to remove/hide the header from the sharepoint list

  • Wednesday, August 27, 2008 11:10 AM
     
     
     Hello All,

    I want to remove the header from the sharepoint list.

    I have created a view of a list and I used it on the web part page . Now the data has been displayed with headers in the list.

    I dont want to show the headers in the list.

    Please let me how to remove / hide header.

    Thanks and Regards,
    Kesavan

All Replies

  • Wednesday, August 27, 2008 11:47 AM
     
     

    I don't believe there is any way to do that from within SharePoint - you'll need to open the page in SP Designer to modify that.  Once you have the page open, right-click the web part and choose Convert to XSLT View.  That will make the list editable so that you can delete the first row containing the headers.

    Chanda

  • Wednesday, August 27, 2008 2:31 PM
     
     Answered Has Code
    Hello Chanda,

    Thanks for your post. But I can't use it for my dynamic list. I found the solution myself.

    I created content editor web part and added the below scripts. The script will find the header row through the class name 'ms-viewheadertr' and makes the header row to invisible.

    <script type="text/javascript" language="javascript">   
    _spBodyOnLoadFunctionNames.push("HideHeaders");   
     
    function HideHeaders()   
    {   
      var elements = getElementsByClassName(document"tr""ms-viewheadertr");   
     
      for(var i=0;i<elements.length;i++)   
       {   
         elem = elements[i];   
         elem.style.display = "none";   
       }   
    }   
     
     
    function getElementsByClassName(oElm, strTagName, strClassName){   
        var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);   
        var arrReturnElements = new Array();   
        strClassName = strClassName.replace(/\-/g, "\\-");   
        var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");   
        var oElement;   
        for(var i=0; i<arrElements.length; i++){   
            oElement = arrElements[i];   
            if(oRegExp.test(oElement.className)){   
                arrReturnElements.push(oElement);   
            }   
        }   
        return (arrReturnElements)   
    }   
    </script> 

    Thanks and Regards,
    Kesavan
  • Tuesday, October 11, 2011 4:17 PM
     
     
    Awesome!  But what if I just want to remove the header from one webpart and not every web part on the page?