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="" type="text/javascript">
2 </script><script type="text/javascript">
3 $(function(){
4 $(".ms-viewheadertr th:contains('Name')").css("width", "50px");
5 });
6 </script>

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