I have a list with a huge amount of data. I would like the header row (with the titles of the columns) and the first X columns (the number varies depending on the list view) to remain frozen while the user scrolls through the content. I know that Datasheet View freezes the header row, but I need the Standard View to do so. I know that I can accomplish this with a standard table in a standard HTML page using the code from http://fixedheadertable.com/.

So, now I am trying to determine how to integrate that code with my list. I figure I can add the jQuery via a reference in my Master page (I have found a few references on how to do that). But, I'm not still not sure of the steps.

More significantly, I have muliptle views of my list. I know that I can modify the code of each view's aspx page in SPD. Since each view is different, I figure that I must add view-specific code to each view's aspx page. But how? where?

I am sure that I am over-complicating things, but I just don't see how to get from http://fixedheadertable.com/ to making it work in SharePoint.

Thanks very much for your help!!

3 Answers 3


Just happened to run across your question. Not sure if you work with JQuery but the code below works on a List View.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>

<style type="text/css">
.DataGridFixedHeader { position: relative; top: expression(this.offsetParent.scrollTop);}

<script type="text/javascript">
var $table = $("TABLE[ID^='{4C9CFF20-B467-4E10-820C-0A132442CF98}']:first", "#MSO_ContentTable");

$table.wrap("<DIV style='OVERFLOW: auto; HEIGHT: 420px'></DIV>");
$("TR.ms-viewheadertr:first", $table).addClass("DataGridFixedHeader");
  • Hi Charlie. Thanks for your feedback. I think I'm just totally lost here. I put the minified reference that you listed above, the table wrapping code that you listed, the styles provided for FixedHeaderTable, the jQuery code for FixedHeaderTable (from jquery.fixedheadertable.js), and javascript that defines the table parameters (from demo.js). I also modified those parameters to refer to the class that you listed (DataGridFixedHeader). I stopped editing and refreshed the listview: no change. I know I am being totally stupid here, but I am just completely lost. Please help, and thanks!! Commented Dec 29, 2011 at 22:08
  • 1
    I think your code is from kjellsj.blogspot.com/2009/06/… and my understanding is that does not work for SharePoint 2010 and IE8 (I think it uses the deprecated CSS "expression"). Commented Dec 29, 2011 at 22:22
  • Hi Kit. Thanks for the update, but with the "expression" css, it fails in modern browsers. Any ideas? Commented Dec 30, 2011 at 17:01

SharePoint list views don't have a standard structure with a head section. To make your code work, you'll need to:

  • add a head tag to your table (prepend)
  • Move the headers (first row of the body) to the head

For SharePoint 2010 only. One can use below script for freezing header of the list. It provides both vertical and horizontal scrolling of headers.

//jquery lib
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>

//style sheet
<style type="text/css">
.fixedBlock {
    POSITION: fixed; TOP: 15px

//jquery script to freeze header
<script type="text/javascript">

var leftInit;
var top;

$(document).ready(function () {
//get left and top offset of the header
leftInit = $('tr.ms-viewheadertr').offset().left;
top = $('tr.ms-viewheadertr').offset().top;

//scrolling event
$('#s4-workspace').scroll(function() {
    var x = 0 - $('#s4-workspace').scrollLeft();
    var y = $('#s4-workspace').scrollTop();
    var rowWidth = $('tr.ms-viewheadertr').width();
    if (y >= top) {
             left: x + leftInit
        $('table.ms-listviewtable').css('width', rowWidth+"px");
    } else {



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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