Wednesday, December 29, 2010

How to increase width of SharePoint List Column

One of my user asked me how we can increase width of SharePoint List Column. SharePoint does not provide a direct way to increase the width of list column. Now again this is a customization.
But one way I could solve this problem is by using javascript.
Copy paste this code in between opening and closing script tags (
) a Content Editor web part and then change the name of the columns like Title, Department etc. Then you are done.

open script tag here:
< script src="http://servername/Style%20Library/list name/jquery-1.4.2.min.js" type="text/javascript" >
< / script >

< script type="text/javascript" >
$(function(){
$("TH.ms-vh2:contains('Title')").css("width", "130px");
$("TH.ms-vh2:contains('Department')").css("width", "150px");
});

< / script >
Close your script tag here

No comments: