Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. <style>
  2. .ms-viewheadertr {
  3. BACKGROUND-COLOR: white
  4. }
  5. </style><script>
  6.  
  7. /* wrap the table in a div, set its height, give it scrollbars, and move it down */
  8. var myTable = document.querySelector(".ms-listviewtable");
  9. var wrapperDiv = document.createElement('div');
  10. wrapperDiv.setAttribute("ID","FreezePaneWrapper");
  11. wrapperDiv.setAttribute("style","OVERFLOW: auto; HEIGHT: "+ (document.documentElement.clientHeight - document.getElementById("s4-bodyContainer").clientHeight - document.getElementById("s4-ribbonrow").scrollHeight - 50) +"px; padding-top:38px;");
  12. wrapperDiv.appendChild(myTable.cloneNode(true));
  13. myTable.parentNode.replaceChild(wrapperDiv,myTable);
  14. /* Freeze the header row and move it up*/
  15. var headerRow = document.querySelector(".ms-viewheadertr");
  16. document.getElementById("FreezePaneWrapper").style.width = "" + headerRow.clientWidth + "px";
  17. headerRow.style.width = "" + headerRow.clientWidth + "px";
  18. headerRow.style.position = "absolute";
  19. headerRow.style.top = ""+(headerRow.offsetTop-39)+"px";
  20. /* Tell the header's columns to be the same width as the cells in the first "alternating" row */
  21. var columns = document.querySelector("table.ms-listviewtable tr.ms-alternating").querySelectorAll("tr>td");
  22. headers = document.querySelectorAll("tr.ms-viewheadertr th");
  23. for(var i = 0; i < headers.length; i++){
  24. if(columns[i].clientWidth > headers[i].clientWidth){
  25. headers[i].style.width = ""+columns[i].clientWidth + "px";
  26. }else{
  27. columns[i].style.width = ""+headers[i].clientWidth + "px";
  28. }
  29. }
  30.  
  31. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement