Thursday, May 29, 2014

Set the column width i SharePoint

Just a small script for safe keeping. This script will search for column with a title e.g. Name and set the column width. To set more columns, add new line to the script and change the selector

1 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript">
2 </script><script type="text/javascript">
3 $(function(){
4 $(".ms-viewheadertr th:contains('Name')").css("width", "50px");
5 });
6 </script>
7

This script is tested with document libraries both on 2010 and 2013.

1 comment:

  1. Wow. This really made my day. Thanks a lot!
    JavaScript Training Courses JavaScript Training Courses Javascript Online Training Javascript Online Training

    Javascript Online Training JQuery Online Training JQuery Online Training Javascript Online Training

    ReplyDelete